mirror of
https://github.com/aclindsa/moneygo.git
synced 2024-10-30 15:50:04 -04:00
24 lines
510 B
Go
24 lines
510 B
Go
|
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
|
||
|
}
|