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)
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 {
case serverConfig.Socket != "":

View File

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

View File

@ -22,16 +22,13 @@ func init() {
if err != nil {
log.Fatalf("Error reading YAML data: %v", err)
}
log.Println(GlobalConfiguration)
setDefaults()
log.Println(GlobalConfiguration)
// Unmarshal the YAML data into the Settings struct
err = yaml.Unmarshal(yamlData, &GlobalConfiguration)
if err != nil {
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
// 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) {
var auther auth.Auther
fmt.Println("auth.go", t)
switch t {
case "password":
auther = &auth.JSONAuth{}
@ -27,6 +26,7 @@ func (s authBackend) Get(t string) (auth.Auther, error) {
default:
return nil, errors.ErrInvalidAuthMethod
}
fmt.Println("auth.go", t)
return auther, get(s.db, "auther", auther)
}