style: Up conf
This commit is contained in:
@@ -40,6 +40,27 @@ proxy:
|
|||||||
jwt:
|
jwt:
|
||||||
key: ""
|
key: ""
|
||||||
expire-duration: 360000
|
expire-duration: 360000
|
||||||
|
ldap:
|
||||||
|
enable: false
|
||||||
|
url: "ldap://ldap.example.com:389"
|
||||||
|
tls: false
|
||||||
|
tls-verify: false
|
||||||
|
base-dn: "dc=example,dc=com"
|
||||||
|
bind-dn: "cn=admin,dc=example,dc=com"
|
||||||
|
bind-password: "password"
|
||||||
|
|
||||||
|
user:
|
||||||
|
base-dn: "ou=users,dc=example,dc=com"
|
||||||
|
enable-attr: "" #The attribute name of the user for enabling, in AD it is "userAccountControl", empty means no enable attribute, all users are enabled
|
||||||
|
enable-attr-value: "" # The value of the enable attribute when the user is enabled. If you are using AD, just set random value, it will be ignored.
|
||||||
|
filter: "(cn=*)"
|
||||||
|
username: "uid" # The attribute name of the user for usernamem if you are using AD, it should be "sAMAccountName"
|
||||||
|
email: "mail"
|
||||||
|
first-name: "givenName"
|
||||||
|
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.
|
||||||
|
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:
|
redis:
|
||||||
addr: "127.0.0.1:6379"
|
addr: "127.0.0.1:6379"
|
||||||
password: ""
|
password: ""
|
||||||
@@ -58,23 +79,3 @@ oss:
|
|||||||
expire-time: 30
|
expire-time: 30
|
||||||
max-byte: 10240
|
max-byte: 10240
|
||||||
|
|
||||||
ldap:
|
|
||||||
enable: false
|
|
||||||
url: "ldap://ldap.example.com:389"
|
|
||||||
tls: false
|
|
||||||
tls-verify: false
|
|
||||||
base-dn: "dc=example,dc=com"
|
|
||||||
bind-dn: "cn=admin,dc=example,dc=com"
|
|
||||||
bind-password: "password"
|
|
||||||
|
|
||||||
user:
|
|
||||||
base-dn: "ou=users,dc=example,dc=com"
|
|
||||||
enable-attr: "" #The attribute name of the user for enabling, in AD it is "userAccountControl", empty means no enable attribute, all users are enabled
|
|
||||||
enable-attr-value: "" # The value of the enable attribute when the user is enabled. If you are using AD, just set random value, it will be ignored.
|
|
||||||
filter: "(cn=*)"
|
|
||||||
username: "uid" # The attribute name of the user for usernamem if you are using AD, it should be "sAMAccountName"
|
|
||||||
email: "mail"
|
|
||||||
first-name: "givenName"
|
|
||||||
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.
|
|
||||||
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.
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package config
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/fsnotify/fsnotify"
|
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
@@ -38,7 +37,7 @@ type Config struct {
|
|||||||
Jwt Jwt
|
Jwt Jwt
|
||||||
Rustdesk Rustdesk
|
Rustdesk Rustdesk
|
||||||
Proxy Proxy
|
Proxy Proxy
|
||||||
Ldap Ldap
|
Ldap Ldap
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init 初始化配置
|
// Init 初始化配置
|
||||||
@@ -57,15 +56,19 @@ 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) {
|
|
||||||
//配置文件修改监听
|
/*
|
||||||
fmt.Println("config file changed:", e.Name)
|
//监听配置修改没什么必要
|
||||||
if err2 := v.Unmarshal(rowVal); err2 != nil {
|
v.OnConfigChange(func(e fsnotify.Event) {
|
||||||
fmt.Println(err2)
|
//配置文件修改监听
|
||||||
}
|
fmt.Println("config file changed:", e.Name)
|
||||||
rowVal.Rustdesk.LoadKeyFile()
|
if err2 := v.Unmarshal(rowVal); err2 != nil {
|
||||||
rowVal.Rustdesk.ParsePort()
|
fmt.Println(err2)
|
||||||
})
|
}
|
||||||
|
rowVal.Rustdesk.LoadKeyFile()
|
||||||
|
rowVal.Rustdesk.ParsePort()
|
||||||
|
})
|
||||||
|
*/
|
||||||
if err := v.Unmarshal(rowVal); err != nil {
|
if err := v.Unmarshal(rowVal); err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user