22 lines
297 B
Go
22 lines
297 B
Go
package config
|
|
|
|
import (
|
|
"github.com/philandstuff/dhall-golang/v6"
|
|
)
|
|
|
|
type Config struct {
|
|
Port int
|
|
AppName string
|
|
}
|
|
|
|
func LoadConfig(path string) (*Config, error) {
|
|
var config Config
|
|
|
|
err := dhall.UnmarshalFile(path, &config)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &config, nil
|
|
}
|