30 lines
481 B
Go
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
|
|
}
|