style: Up conf

This commit is contained in:
lejianwen
2025-02-07 15:58:13 +08:00
parent 3a16269215
commit a3c3ab5a72
2 changed files with 35 additions and 31 deletions

View File

@@ -40,24 +40,6 @@ proxy:
jwt: jwt:
key: "" key: ""
expire-duration: 360000 expire-duration: 360000
redis:
addr: "127.0.0.1:6379"
password: ""
db: 0
cache:
type: "file"
file-dir: "./runtime/cache"
redis-addr: "127.0.0.1:6379"
redis-pwd: ""
redis-db: 0
oss:
access-key-id: ""
access-key-secret: ""
host: ""
callback-url: ""
expire-time: 30
max-byte: 10240
ldap: ldap:
enable: false enable: false
url: "ldap://ldap.example.com:389" url: "ldap://ldap.example.com:389"
@@ -78,3 +60,22 @@ ldap:
last-name: "sn" last-name: "sn"
sync: false # If true, the user will be synchronized to the database when the user logs in. If false, the user will be synchronized to the database when the user be created. sync: false # If true, the user will be synchronized to the database when the user logs in. If false, the user will be synchronized to the database when the user be created.
admin-group: "cn=admin,dc=example,dc=com" # The group name of the admin group, if the user is in this group, the user will be an admin. admin-group: "cn=admin,dc=example,dc=com" # The group name of the admin group, if the user is in this group, the user will be an admin.
redis:
addr: "127.0.0.1:6379"
password: ""
db: 0
cache:
type: "file"
file-dir: "./runtime/cache"
redis-addr: "127.0.0.1:6379"
redis-pwd: ""
redis-db: 0
oss:
access-key-id: ""
access-key-secret: ""
host: ""
callback-url: ""
expire-time: 30
max-byte: 10240

View File

@@ -2,7 +2,6 @@ package config
import ( import (
"fmt" "fmt"
"github.com/fsnotify/fsnotify"
"github.com/spf13/viper" "github.com/spf13/viper"
"strings" "strings"
) )
@@ -57,6 +56,9 @@ func Init(rowVal *Config, path string) *viper.Viper {
panic(fmt.Errorf("Fatal error config file: %s \n", err)) panic(fmt.Errorf("Fatal error config file: %s \n", err))
} }
v.WatchConfig() v.WatchConfig()
/*
//监听配置修改没什么必要
v.OnConfigChange(func(e fsnotify.Event) { v.OnConfigChange(func(e fsnotify.Event) {
//配置文件修改监听 //配置文件修改监听
fmt.Println("config file changed:", e.Name) fmt.Println("config file changed:", e.Name)
@@ -66,6 +68,7 @@ func Init(rowVal *Config, path string) *viper.Viper {
rowVal.Rustdesk.LoadKeyFile() rowVal.Rustdesk.LoadKeyFile()
rowVal.Rustdesk.ParsePort() rowVal.Rustdesk.ParsePort()
}) })
*/
if err := v.Unmarshal(rowVal); err != nil { if err := v.Unmarshal(rowVal); err != nil {
fmt.Println(err) fmt.Println(err)
} }