1
0
mirror of https://github.com/aclindsa/moneygo.git synced 2025-07-03 12:48:38 -04:00

Move to using config file

This commit is contained in:
2017-10-01 21:15:40 -04:00
parent debd221796
commit f88fed966b
4 changed files with 55 additions and 30 deletions

23
config.go Normal file
View File

@ -0,0 +1,23 @@
package main
import (
"fmt"
"gopkg.in/gcfg.v1"
)
type Config struct {
MoneyGo struct {
Fcgi bool // whether to serve FCGI (HTTP by default if false)
Base_directory string // base directory for serving files out of
Port int // port to serve API/files on
}
}
func readConfig(filename string) (*Config, error) {
var cfg Config
err := gcfg.ReadFileInto(&cfg, filename)
if err != nil {
return nil, fmt.Errorf("Failed to parse config file: %s", err)
}
return &cfg, nil
}