This commit is contained in:
Graham Steffaniak 2023-09-01 18:30:51 -05:00
parent 99bcec49c3
commit adbf5b21fe
4 changed files with 10 additions and 9 deletions

View File

@ -111,7 +111,11 @@ user created with the credentials from options "username" and "password".`,
checkErr(err) checkErr(err)
var listener net.Listener var listener net.Listener
address := serverConfig.Address + ":" + strconv.Itoa(serverConfig.Port) listenAddress := serverConfig.Address
if listenAddress == "" {
listenAddress = "[::]" // default an
}
address := listenAddress + ":" + strconv.Itoa(serverConfig.Port)
switch { switch {
case serverConfig.Socket != "": case serverConfig.Socket != "":

View File

@ -1,6 +1,6 @@
server: server:
port: 8050 port: 8080
baseURL: "" baseURL: "/"
address: '' address: ''
log: stdout log: stdout
database: database.db database: database.db
@ -12,7 +12,7 @@ general:
disable-type-detection-by-header: false disable-type-detection-by-header: false
auth: auth:
header: '' header: ''
method: password method: noauth
command: '' command: ''
signup: false signup: false
shell: '' shell: ''

View File

@ -22,16 +22,13 @@ func init() {
if err != nil { if err != nil {
log.Fatalf("Error reading YAML data: %v", err) log.Fatalf("Error reading YAML data: %v", err)
} }
log.Println(GlobalConfiguration)
setDefaults() setDefaults()
log.Println(GlobalConfiguration)
// Unmarshal the YAML data into the Settings struct // Unmarshal the YAML data into the Settings struct
err = yaml.Unmarshal(yamlData, &GlobalConfiguration) err = yaml.Unmarshal(yamlData, &GlobalConfiguration)
if err != nil { if err != nil {
log.Fatalf("Error unmarshaling YAML data: %v", err) log.Fatalf("Error unmarshaling YAML data: %v", err)
} }
log.Println(GlobalConfiguration) log.Printf("GlobalConfiguration: \n%#v\n", GlobalConfiguration)
// Now you have the Settings struct with values from the YAML file // Now you have the Settings struct with values from the YAML file
// You can access the values like: defaultSettings.Key, defaultSettings.Server.Port, etc. // You can access the values like: defaultSettings.Key, defaultSettings.Server.Port, etc.

View File

@ -14,7 +14,6 @@ type authBackend struct {
func (s authBackend) Get(t string) (auth.Auther, error) { func (s authBackend) Get(t string) (auth.Auther, error) {
var auther auth.Auther var auther auth.Auther
fmt.Println("auth.go", t)
switch t { switch t {
case "password": case "password":
auther = &auth.JSONAuth{} auther = &auth.JSONAuth{}
@ -27,6 +26,7 @@ func (s authBackend) Get(t string) (auth.Auther, error) {
default: default:
return nil, errors.ErrInvalidAuthMethod return nil, errors.ErrInvalidAuthMethod
} }
fmt.Println("auth.go", t)
return auther, get(s.db, "auther", auther) return auther, get(s.db, "auther", auther)
} }