pcmt/config/config.go
leo 9ab2d0ae0b
All checks were successful
continuous-integration/drone Build is passing
continuous-integration/drone/push Build is passing
go: handle host+port combinations,shutdown better
* add log messages telling the user what went wrong if the app fails to
  start
* improve existing log messages
* cleanup: close channels when exiting
* cleanup: stop listening for signals when exiting
2023-05-02 00:04:04 +02:00

30 lines
556 B
Go

package config
import (
"git.dotya.ml/mirre-mt/pcmt/slogging"
"github.com/philandstuff/dhall-golang/v6"
)
type Config struct {
Host string
Port int
AppName string
LiveMode bool
DevelMode bool
SessionCookieName string
SessionCookieSecret string
}
func LoadConfig(path string) (*Config, error) {
var config Config
err := dhall.UnmarshalFile(path, &config)
if err != nil {
return nil, err
}
slogging.GetLogger().Debugf("parsed config: %+v", config)
return &config, nil
}