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