修复配置文件的大小写问题
This commit is contained in:
parent
969e012f57
commit
1030688f58
2
cmd/authlibskin/build.bat
Normal file
2
cmd/authlibskin/build.bat
Normal file
@ -0,0 +1,2 @@
|
||||
SET CGO_ENABLED=0
|
||||
go build -trimpath -ldflags "-w -s"
|
@ -1,54 +1,53 @@
|
||||
# 为 true 则 uuid 生成方式于离线模式相同,若从离线模式切换不会丢失数据。
|
||||
# 已有用户数据的情况下勿更改此项
|
||||
OfflineUUID: true
|
||||
offlineUUID: true
|
||||
|
||||
Port: "0.0.0.0:8080"
|
||||
port: "0.0.0.0:8080"
|
||||
|
||||
Log:
|
||||
Level: "debug"
|
||||
# json 格式输出
|
||||
Json: false
|
||||
|
||||
Sql:
|
||||
MysqlDsn: ""
|
||||
sql:
|
||||
mysqlDsn: ""
|
||||
|
||||
# 输出每条执行的 sql 语句
|
||||
Debug: false
|
||||
debug: false
|
||||
|
||||
Cache:
|
||||
cache:
|
||||
# 默认使用内存缓存,若需要集群部署,请更换 redis
|
||||
Type: ""
|
||||
type: ""
|
||||
# 内存缓存使用大小,单位 b
|
||||
Ram: 10000000
|
||||
ram: 10000000
|
||||
|
||||
# 位于反向代理后启用,用于记录真实 ip
|
||||
RaelIP: false
|
||||
raelIP: false
|
||||
|
||||
# ip 段最大注册用户,ipv4 为 /24 ipv6 为 /48
|
||||
MaxIpUser: 10
|
||||
maxIpUser: 10
|
||||
|
||||
# 运行后勿修改,若为集群需设置为一致
|
||||
RsaPriKey: ""
|
||||
rsaPriKey: ""
|
||||
|
||||
# 材质文件保存路径,如果需要对象存储可以把对象储存挂载到本地目录上
|
||||
TexturePath: "skin"
|
||||
texturePath: "skin"
|
||||
|
||||
# 材质静态文件提供基础地址
|
||||
# 如果静态文件位于 oss 上,比如 https://s3.amazonaws.com/example/1.png
|
||||
# 则填写 https://s3.amazonaws.com/example
|
||||
TextureBaseUrl: ""
|
||||
textureBaseUrl: ""
|
||||
|
||||
# 用于在支持的启动器中展示本站的注册地址
|
||||
# 填写类似 https://example.com
|
||||
WebBaseUrl: ""
|
||||
webBaseUrl: ""
|
||||
|
||||
# 皮肤站名字,用于在多个地方展示
|
||||
ServerName: ""
|
||||
serverName: ""
|
||||
|
||||
|
||||
Captcha:
|
||||
captcha:
|
||||
# 验证码类型,目前只支持 cloudflare turnstile
|
||||
# 填写 turnstile
|
||||
Type: ""
|
||||
SiteKey: ""
|
||||
Secret: ""
|
||||
type: ""
|
||||
siteKey: ""
|
||||
secret: ""
|
||||
|
@ -30,7 +30,7 @@ func main() {
|
||||
if err != nil {
|
||||
if errors.Is(err, os.ErrNotExist) {
|
||||
lo.Must0(os.WriteFile("config.yaml", configTempLate, 0600))
|
||||
fmt.Println("已写入模板配置文件")
|
||||
fmt.Println("未找到配置文件,已写入模板配置文件")
|
||||
return
|
||||
}
|
||||
panic(err)
|
||||
|
@ -1,31 +1,31 @@
|
||||
package config
|
||||
|
||||
type Config struct {
|
||||
OfflineUUID bool
|
||||
Port string
|
||||
OfflineUUID bool `yaml:"offlineUUID"`
|
||||
Port string `yaml:"port"`
|
||||
Log struct {
|
||||
Level string
|
||||
Json bool
|
||||
}
|
||||
Level string `yaml:"level"`
|
||||
Json bool `yaml:"json"`
|
||||
} `yaml:"log"`
|
||||
Sql struct {
|
||||
MysqlDsn string
|
||||
}
|
||||
Debug bool
|
||||
MysqlDsn string `yaml:"mysqlDsn"`
|
||||
} `yaml:"sql"`
|
||||
Debug bool `yaml:"debug"`
|
||||
Cache struct {
|
||||
Type string
|
||||
Ram int
|
||||
}
|
||||
RaelIP bool
|
||||
MaxIpUser int
|
||||
RsaPriKey string
|
||||
TexturePath string
|
||||
TextureBaseUrl string
|
||||
WebBaseUrl string
|
||||
ServerName string
|
||||
Type string `yaml:"type"`
|
||||
Ram int `yaml:"ram"`
|
||||
} `yaml:"cache"`
|
||||
RaelIP bool `yaml:"raelIP"`
|
||||
MaxIpUser int `yaml:"maxIpUser"`
|
||||
RsaPriKey string `yaml:"rsaPriKey"`
|
||||
TexturePath string `yaml:"texturePath"`
|
||||
TextureBaseUrl string `yaml:"textureBaseUrl"`
|
||||
WebBaseUrl string `yaml:"webBaseUrl"`
|
||||
ServerName string `yaml:"serverName"`
|
||||
|
||||
Captcha struct {
|
||||
Type string
|
||||
SiteKey string
|
||||
Secret string
|
||||
}
|
||||
Type string `yaml:"type"`
|
||||
SiteKey string `yaml:"siteKey"`
|
||||
Secret string `yaml:"ecret"`
|
||||
} `yaml:"captcha"`
|
||||
}
|
||||
|
53
config/config.yaml
Normal file
53
config/config.yaml
Normal file
@ -0,0 +1,53 @@
|
||||
# 为 true 则 uuid 生成方式于离线模式相同,若从离线模式切换不会丢失数据。
|
||||
# 已有用户数据的情况下勿更改此项
|
||||
offlineUUID: true
|
||||
|
||||
port: "127.0.0.1:8080"
|
||||
|
||||
Log:
|
||||
Level: "debug"
|
||||
# json 格式输出
|
||||
Json: false
|
||||
|
||||
sql:
|
||||
mysqlDsn: "123"
|
||||
|
||||
# 输出每条执行的 sql 语句
|
||||
debug: false
|
||||
|
||||
cache:
|
||||
# 默认使用内存缓存,若需要集群部署,请更换 redis
|
||||
type: ""
|
||||
# 内存缓存使用大小,单位 b
|
||||
ram: 10000000
|
||||
|
||||
# 位于反向代理后启用,用于记录真实 ip
|
||||
raelIP: false
|
||||
|
||||
# ip 段最大注册用户,ipv4 为 /24 ipv6 为 /48
|
||||
maxIpUser: 10
|
||||
|
||||
# 运行后勿修改,若为集群需设置为一致
|
||||
rsaPriKey: ""
|
||||
|
||||
# 材质文件保存路径,如果需要对象存储可以把对象储存挂载到本地目录上
|
||||
texturePath: "skin"
|
||||
|
||||
# 材质静态文件提供基础地址
|
||||
# 如果静态文件位于 oss 上,比如 https://s3.amazonaws.com/example/1.png
|
||||
# 则填写 https://s3.amazonaws.com/example
|
||||
textureBaseUrl: ""
|
||||
|
||||
# 用于在支持的启动器中展示本站的注册地址
|
||||
# 填写类似 https://example.com
|
||||
webBaseUrl: ""
|
||||
|
||||
# 皮肤站名字,用于在多个地方展示
|
||||
serverName: ""
|
||||
|
||||
captcha:
|
||||
# 验证码类型,目前只支持 cloudflare turnstile
|
||||
# 填写 turnstile
|
||||
type: ""
|
||||
siteKey: ""
|
||||
secret: ""
|
@ -12,5 +12,6 @@ func YamlDeCode(b []byte) (Config, error) {
|
||||
if err != nil {
|
||||
return c, fmt.Errorf("YamlDeCode: %w", err)
|
||||
}
|
||||
fmt.Println(c)
|
||||
return c, nil
|
||||
}
|
||||
|
20
config/yaml_test.go
Normal file
20
config/yaml_test.go
Normal file
@ -0,0 +1,20 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestYamlDeCode(t *testing.T) {
|
||||
b, err := os.ReadFile("config.yaml")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
c, err := YamlDeCode(b)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if c.Sql.MysqlDsn != "123" {
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user