233
This commit is contained in:
@@ -1 +0,0 @@
|
||||
e7a720b3-b16e-4dc4-b31c-a9c87709ea20
|
||||
@@ -1 +0,0 @@
|
||||
da3d4927-dcc5-4dd3-b8e2-42b1cf9b5eaa
|
||||
@@ -1,80 +0,0 @@
|
||||
# https://www.express-gateway.io/docs/configuration/gateway.config.yml/
|
||||
# https://www.cnblogs.com/PLM-Teamcenter/p/16388583.html
|
||||
|
||||
http:
|
||||
port: 8080
|
||||
admin:
|
||||
port: 9876
|
||||
host: localhost
|
||||
# 指定具体的客户端 - 绑定域名和 被映射的接口地址
|
||||
apiEndpoints:
|
||||
api:
|
||||
host: localhost
|
||||
paths: '/ip'
|
||||
|
||||
user_client:
|
||||
host: localhost
|
||||
paths:
|
||||
- /user
|
||||
- /user/*
|
||||
|
||||
articles_client:
|
||||
host: localhost
|
||||
paths:
|
||||
- /articles
|
||||
- /articles/*
|
||||
|
||||
# 声明网关可以管理的微服务 - 被代理的地址
|
||||
serviceEndpoints:
|
||||
userbin:
|
||||
url: 'http://127.0.0.1:3002'
|
||||
|
||||
articlesbin:
|
||||
url: 'http://127.0.0.1:3003'
|
||||
|
||||
httpbin:
|
||||
url: 'https://httpbin.org'
|
||||
|
||||
policies:
|
||||
- basic-auth
|
||||
- cors
|
||||
- expression
|
||||
- key-auth
|
||||
- log
|
||||
- oauth2
|
||||
- proxy
|
||||
- rate-limit
|
||||
|
||||
# 通过管道把客户端与微服务串联起来
|
||||
pipelines:
|
||||
|
||||
default:
|
||||
apiEndpoints:
|
||||
- api
|
||||
policies:
|
||||
# Uncomment `key-auth:` when instructed to in the Getting Started guide.
|
||||
# - key-auth:
|
||||
# proxy;它的作用是代理/转发请求,这里指定了将 apiEndpoints 来的请求转发到前面定义了的微服务
|
||||
- proxy:
|
||||
- action:
|
||||
serviceEndpoint: httpbin
|
||||
changeOrigin: true
|
||||
|
||||
pipeline_user:
|
||||
apiEndpoints:
|
||||
- user_client
|
||||
policies:
|
||||
- proxy:
|
||||
- action:
|
||||
serviceEndpoint: userbin
|
||||
changeOrigin: true
|
||||
|
||||
pipeline_articles:
|
||||
apiEndpoints:
|
||||
- articles_client
|
||||
policies:
|
||||
- proxy:
|
||||
- action:
|
||||
serviceEndpoint: articlesbin
|
||||
changeOrigin: true
|
||||
|
||||
@@ -1,103 +0,0 @@
|
||||
{
|
||||
"http": {
|
||||
"port": 8080
|
||||
},
|
||||
"admin": {
|
||||
"port": 9876,
|
||||
"host": "localhost"
|
||||
},
|
||||
"apiEndpoints": {
|
||||
"api": {
|
||||
"host": "localhost",
|
||||
"paths": "/ip"
|
||||
},
|
||||
"user_client": {
|
||||
"host": "localhost",
|
||||
"paths": [
|
||||
"/user",
|
||||
"/user/*"
|
||||
]
|
||||
},
|
||||
"articles_client": {
|
||||
"host": "localhost",
|
||||
"paths": [
|
||||
"/articles",
|
||||
"/articles/*"
|
||||
]
|
||||
}
|
||||
},
|
||||
"serviceEndpoints": {
|
||||
"userbin": {
|
||||
"url": "http://127.0.0.1:3002"
|
||||
},
|
||||
"articlesbin": {
|
||||
"url": "http://127.0.0.1:3003"
|
||||
},
|
||||
"httpbin": {
|
||||
"url": "https://httpbin.org"
|
||||
}
|
||||
},
|
||||
"policies": [
|
||||
"basic-auth",
|
||||
"cors",
|
||||
"expression",
|
||||
"key-auth",
|
||||
"log",
|
||||
"oauth2",
|
||||
"proxy",
|
||||
"rate-limit"
|
||||
],
|
||||
"pipelines": {
|
||||
"default": {
|
||||
"apiEndpoints": [
|
||||
"api"
|
||||
],
|
||||
"policies": [
|
||||
{
|
||||
"proxy": [
|
||||
{
|
||||
"action": {
|
||||
"serviceEndpoint": "httpbin",
|
||||
"changeOrigin": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"pipeline_user": {
|
||||
"apiEndpoints": [
|
||||
"user_client"
|
||||
],
|
||||
"policies": [
|
||||
{
|
||||
"proxy": [
|
||||
{
|
||||
"action": {
|
||||
"serviceEndpoint": "userbin",
|
||||
"changeOrigin": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"pipeline_articles": {
|
||||
"apiEndpoints": [
|
||||
"articles_client"
|
||||
],
|
||||
"policies": [
|
||||
{
|
||||
"proxy": [
|
||||
{
|
||||
"action": {
|
||||
"serviceEndpoint": "articlesbin",
|
||||
"changeOrigin": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
32
gateway/config/gateway.config.yml
Normal file
32
gateway/config/gateway.config.yml
Normal file
@@ -0,0 +1,32 @@
|
||||
http:
|
||||
port: 8080
|
||||
admin:
|
||||
port: 9876
|
||||
host: localhost
|
||||
apiEndpoints:
|
||||
api:
|
||||
host: localhost
|
||||
paths: '/ip'
|
||||
serviceEndpoints:
|
||||
httpbin:
|
||||
url: 'https://httpbin.org'
|
||||
policies:
|
||||
- basic-auth
|
||||
- cors
|
||||
- expression
|
||||
- key-auth
|
||||
- log
|
||||
- oauth2
|
||||
- proxy
|
||||
- rate-limit
|
||||
pipelines:
|
||||
default:
|
||||
apiEndpoints:
|
||||
- api
|
||||
policies:
|
||||
# Uncomment `key-auth:` when instructed to in the Getting Started guide.
|
||||
# - key-auth:
|
||||
- proxy:
|
||||
- action:
|
||||
serviceEndpoint: httpbin
|
||||
changeOrigin: true
|
||||
@@ -1 +0,0 @@
|
||||
dbd3cf03-e067-4aed-9f60-fbd5cc998830
|
||||
@@ -1,27 +0,0 @@
|
||||
{
|
||||
"db": {
|
||||
"redis": {
|
||||
"emulate": true,
|
||||
"namespace": "EG"
|
||||
}
|
||||
},
|
||||
"crypto": {
|
||||
"cipherKey": "sensitiveKey",
|
||||
"algorithm": "aes256",
|
||||
"saltRounds": 10
|
||||
},
|
||||
"session": {
|
||||
"secret": "keyboard cat",
|
||||
"resave": false,
|
||||
"saveUninitialized": false
|
||||
},
|
||||
"accessTokens": {
|
||||
"timeToExpiry": 7200000
|
||||
},
|
||||
"refreshTokens": {
|
||||
"timeToExpiry": 7200000
|
||||
},
|
||||
"authorizationCodes": {
|
||||
"timeToExpiry": 300000
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user