added sample config

This commit is contained in:
grumbulon 2023-01-09 17:30:39 -05:00
parent 55383869d1
commit 200997976d
2 changed files with 5 additions and 3 deletions

3
config.sample.yaml Normal file
View file

@ -0,0 +1,3 @@
server: example.com # does nothing yet
hashingsecret: PasswordHashingSecret
port: 3008 # port the server runs on

View file

@ -59,20 +59,19 @@ func ReadConfig() (*Config, error) {
if data, err = os.ReadFile(filepath.Clean(defaultConfigPath)); err == nil {
if err = yaml.Unmarshal(data, &config); err != nil {
return &Config{}, fmt.Errorf("unable to unmarshal config file: %w", err)
}
return &config, nil
}
if data, err = os.ReadFile(filepath.Clean("./config.yaml")); err == nil {
if err = yaml.Unmarshal(data, &config); err != nil {
return &Config{}, fmt.Errorf("unable to unmarshal config file: %w", err)
}
return &config, nil
}
return &Config{}, fmt.Errorf("unable to read config file: %w", err)
}