Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]yaml类型的配置文件,读取到本地以后,驼峰法的key变成全小写了。 #319

Open
xuxiaofan1101 opened this issue Oct 11, 2024 · 0 comments
Assignees
Labels

Comments

@xuxiaofan1101
Copy link

xuxiaofan1101 commented Oct 11, 2024

请简单描述bug的场景
yaml类型的配置文件,读取到本地以后,驼峰法的key变成全小写了。

如何重现

再现行为的步骤:
1、创建一个yaml的namespace,然后将驼峰法的yaml配置写入。
示例:
system:
appName: "hotgo"
debug: true
mode: "develop"
ipMethod: "whois"
isDemo: false
isCluster: false
log:
switch: true
queue: true
module: [ "admin", "api", "default" ]
skipCode: [ ]
serveLog:
switch: true
queue: true
levelFormat: [ "WARN", "ERRO", "FATA", "PANI" ]
addonsResourcePath: "resource"

defaultLogger: &defaultLogger
level: "all"
flags: 42
file: "{Y-m-d}.log"
stdoutColorDisabled: false
writerColorEnable: false
rotateExpire: "7d"
rotateBackupLimit: 2
rotateBackupCompress: 2
timeFormat: "2006-01-02T15:04:05Z07:00"

server:
address: ":8000"
openapiPath: "/api.json"
swaggerPath: "/swagger"
serverRoot: "resource/public"
DumpRouterMap: false
logPath: "logs/server"
ErrorStack: true
ErrorLogEnabled: true
errorLogPattern: "error/{Y-m-d}.log"
accessLogEnabled: true
accessLogPattern: "access/{Y-m-d}.log"
maxHeaderBytes: "100KB"
clientMaxBodySize: "200MB"
serverAgent: "HG HTTP Server"
pprofEnabled: true
pprofPattern: "/pprof"
logger:
path: "logs/server"
<<: *defaultLogger

tcp:
server:
address: ":8099"
client:
cron:
group: "cron"
name: "cron1"
address: "127.0.0.1:8099"
appId: "1002"
secretKey: "hotgo"
auth:
group: "auth"
name: "auth1"
address: "127.0.0.1:8099"
appId: "mengshuai"
secretKey: "123456"

logger:
path: "logs/logger"
<<: *defaultLogger
cron:
path: "logs/cron"
<<: *defaultLogger
queue:
path: "logs/queue"
<<: *defaultLogger
tcpServer:
path: "logs/tcpServer"
<<: *defaultLogger
tcpClient:
path: "logs/tcpClient"
<<: *defaultLogger

viewer:
paths: "resource/template"
defaultFile: "index.html"
delimiters: [ "@{", "}" ]
homeLayout: "home/index.html"

setting:
title: "HotGo"
keywords: "中后台解决方案,gf框架,vue3"
description: "hotgo 是一个基于 goframe2,vue3,vite2,TypeScript,uniapp 的中后台解决方案,它可以帮助你快速搭建企业级中后台项目,相信不管是从新技术使用还是其他方面,都能帮助到你,持续更新中。"

router:
admin:
prefix: "/admin"
exceptLogin: [
"/sms/send",
"/wechat/authorizeCall"
]
exceptAuth: [
"/member/info",
"/role/dynamic",
"/notice/pullMessages",
"/notice/readAll",
"/notice/upRead",
"/dictData/option",
"/dictData/options",
"/provinces/select",
"/provinces/cityLabel",
"/member/option"
]
api:
prefix: "/api"
exceptLogin: [ ]
websocket:
prefix: "/socket"
exceptLogin: [ ]
home:
prefix: "/home"
exceptLogin: [ ]

cache:
adapter: "file"
fileDir: "./storage/cache"

token:
secretKey: "hotgo123"
expires: 604800
autoRefresh: true
refreshInterval: 86400
maxRefreshTimes: 30
multiLogin: true

queue:
switch: true
driver: "disk"
groupName: "hotgo"
disk:
path: "./storage/diskqueue"
batchSize: 100
batchTime: 1
segmentSize: 10485760
segmentLimit: 3000
redis:
timeout: 0
rocketmq:
nameSrvAdders: ["127.0.0.1:9876"]
accessKey: ""
secretKey: ""
brokerAddr: "127.0.0.1:10911"
retry: 0
logLevel: "info"
kafka:
address: "127.0.0.1:9092"
version: "2.0.0.0"
randClient: true
multiConsumer: true

redis:
default:
address: "127.0.0.1:6379"
db: "2"
pass: ""
idleTimeout: "20"

database:
logger:
path: "logs/database"
<<: *defaultLogger
stdout: true
default:
link: "mysql:hotgo:hg123456.@tcp(127.0.0.1:3306)/hotgo?loc=Local&parseTime=true&charset=utf8mb4"
debug: true
Prefix: "hg_"

jaeger:
switch: false
endpoint: "127.0.0.1:6831"

hggen:
allowedIPs: [ "127.0.0.1", "*" ]
selectDbs: [ "default" ]
disableTables: [ "hg_sys_gen_codes","hg_admin_role_casbin" ]
delimiters: [ "@{", "}" ]
application:
crud:
templates:
- group: "default"
isAddon: false
masterPackage: "sys"
templatePath: "./resource/generate/default/curd"
apiPath: "./api/admin"
controllerPath: "./internal/controller/admin/sys"
logicPath: "./internal/logic/sys"
inputPath: "./internal/model/input/sysin"
routerPath: "./internal/router/genrouter"
sqlPath: "./storage/data/generate"
webApiPath: "../web/src/api"
webViewsPath: "../web/src/views"
- group: "addon"
isAddon: true
masterPackage: "sys"
templatePath: "./resource/generate/default/curd"
apiPath: "./addons/{$name}/api/admin"
controllerPath: "./addons/{$name}/controller/admin/sys"
logicPath: "./addons/{$name}/logic/sys"
inputPath: "./addons/{$name}/model/input/sysin"
routerPath: "./addons/{$name}/router/genrouter"
sqlPath: "./storage/data/generate/addons"
webApiPath: "../web/src/api/addons/{$name}"
webViewsPath: "../web/src/views/addons/{$name}"

queue:
  templates:
    - group: "default"
      templatePath: "./resource/generate/default/queue"

cron:
  templates:
    - group: "default"
      templatePath: "./resource/generate/default/cron"

addon:
srcPath: "./resource/generate/default/addon"
webApiPath: "../web/src/api/addons/{$name}"
webViewsPath: "../web/src/views/addons/{$name}"

2、本地读取从Apollo读取配置以后,打印key。key:logger.tcpclient.path,这个地方tcpclient原本是小驼峰法的,但是被sdk转成了全小写。影响代码的使用,读取配置时是大小写敏感的。

期望
期望yaml配置读取到本地以后,保持原本配置不变。

截图
如有

Agollo 版本 :
v4.4.0

日志信息

其他上下文
如有

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants