Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mall.oytour.com
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄奎
mall.oytour.com
Commits
baf6eec8
Commit
baf6eec8
authored
Jul 13, 2023
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
dc99c7bd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
11 deletions
+38
-11
Config.cs
Mall.Common/Config.cs
+22
-0
Startup.cs
Mall.WebApi/Startup.cs
+15
-10
appsettings.json
Mall.WebApi/appsettings.json
+1
-1
No files found.
Mall.Common/Config.cs
View file @
baf6eec8
...
@@ -109,6 +109,28 @@ namespace Mall.Common
...
@@ -109,6 +109,28 @@ namespace Mall.Common
return
valueStr
;
return
valueStr
;
}
}
/// <summary>
/// redis服务器
/// </summary>
public
static
string
RedisServer
{
get
{
return
ReadConfigKey
(
"RedisSetting"
,
"RedisServer"
);
}
}
/// <summary>
/// redis密码
/// </summary>
public
static
string
RedisPwd
{
get
{
return
ReadConfigKey
(
"RedisSetting"
,
"RedisPwd"
);
}
}
/// <summary>
/// <summary>
/// 超级管理员id
/// 超级管理员id
/// </summary>
/// </summary>
...
...
Mall.WebApi/Startup.cs
View file @
baf6eec8
...
@@ -77,22 +77,27 @@ namespace Mall.WebApi
...
@@ -77,22 +77,27 @@ namespace Mall.WebApi
"https://mallapi.oytour.com"
,
"https://mallapi.oytour.com"
,
"http://edu.oytour.com"
,
"http://edu.oytour.com"
,
"http://jvs.oytour.com"
,
"http://jvs.oytour.com"
,
"http://pic.oytour.com"
"http://pic.oytour.com"
,
"http://admin.jjsw.vip"
,
"http://mallweb.jjsw.vip"
,
};
};
services
.
AddCors
(
options
=>
options
.
AddPolicy
(
"AllowCors"
,
policy
=>
policy
.
AllowAnyHeader
().
AllowAnyMethod
().
AllowCredentials
().
WithOrigins
(
corsArray
.
ToArray
())));
services
.
AddCors
(
options
=>
options
.
AddPolicy
(
"AllowCors"
,
policy
=>
policy
.
AllowAnyHeader
().
AllowAnyMethod
().
AllowCredentials
().
WithOrigins
(
corsArray
.
ToArray
())));
services
.
Configure
<
ForwardedHeadersOptions
>(
options
=>
//
services.Configure<ForwardedHeadersOptions>(options =>
{
//
{
options
.
ForwardedHeaders
=
Microsoft
.
AspNetCore
.
HttpOverrides
.
ForwardedHeaders
.
XForwardedFor
//
options.ForwardedHeaders = Microsoft.AspNetCore.HttpOverrides.ForwardedHeaders.XForwardedFor
|
Microsoft
.
AspNetCore
.
HttpOverrides
.
ForwardedHeaders
.
XForwardedProto
;
//
| Microsoft.AspNetCore.HttpOverrides.ForwardedHeaders.XForwardedProto;
options
.
KnownProxies
.
Add
(
IPAddress
.
Parse
(
"47.96.12.235"
));
//
options.KnownProxies.Add(IPAddress.Parse("47.96.12.235"));
});
//
});
string
redisConnStr
=
$"
{
Common
.
Config
.
RedisServer
}
,password=
{
Common
.
Config
.
RedisPwd
}
,connectTimeout=5000,allowAdmin=false,defaultDatabase=0"
;
//Api限流
//Api限流
services
.
AddApiThrottle
(
options
=>
{
services
.
AddApiThrottle
(
options
=>
{
//配置redis
//配置redis
options
.
UseRedisCacheAndStorage
(
opts
=>
{
options
.
UseRedisCacheAndStorage
(
opts
=>
opts
.
ConnectionString
=
"47.96.23.199,password=Viitto2018,connectTimeout=5000,allowAdmin=false,defaultDatabase=0"
;
{
opts
.
ConnectionString
=
redisConnStr
;
opts
.
KeyPrefix
=
"apithrottle"
;
//指定给所有key加上前缀,默认为apithrottle
opts
.
KeyPrefix
=
"apithrottle"
;
//指定给所有key加上前缀,默认为apithrottle
});
});
});
});
...
...
Mall.WebApi/appsettings.json
View file @
baf6eec8
...
@@ -79,7 +79,7 @@
...
@@ -79,7 +79,7 @@
"Password"
:
"viitto2019"
"Password"
:
"viitto2019"
},
},
"RedisSetting"
:
{
"RedisSetting"
:
{
"RedisServer"
:
"
47.96.23.199
"
,
"RedisServer"
:
"
192.168.10.214
"
,
"RedisPort"
:
"6379"
,
"RedisPort"
:
"6379"
,
"RedisPwd"
:
"Viitto2018"
"RedisPwd"
:
"Viitto2018"
},
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment