This commit is contained in:
编码猿
2025-08-29 22:03:56 +08:00
parent 5ddcc17391
commit 0df7fa4d45
21 changed files with 83 additions and 376 deletions

View File

@@ -1 +0,0 @@
e7a720b3-b16e-4dc4-b31c-a9c87709ea20

View File

@@ -1 +0,0 @@
da3d4927-dcc5-4dd3-b8e2-42b1cf9b5eaa

View File

@@ -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

View File

@@ -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
}
}
]
}
]
}
}
}

View 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

View File

@@ -1 +0,0 @@
dbd3cf03-e067-4aed-9f60-fbd5cc998830

View File

@@ -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
}
}