pcmt/config/config.go
leo 70ec7f5e53
All checks were successful
continuous-integration/drone/push Build is passing
config: add fields
2023-04-23 19:23:00 +02:00

30 lines
481 B
Go

package config
import (
"log"
"github.com/philandstuff/dhall-golang/v6"
)
type Config struct {
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
}
log.Printf("parsed config: %+v", &config)
return &config, nil
}