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:
23
config.go
Normal file
23
config.go
Normal 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
|
||||
}
|
Reference in New Issue
Block a user