Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
aquameta/config.go
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
46 lines (38 sloc)
861 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"github.com/BurntSushi/toml" | |
) | |
type tomlConfig struct { | |
Database Database `toml:"Database"` | |
AquametaUser AquametaUser `toml:"AquametaUser"` | |
HTTPServer HTTPServer `toml:"HTTPServer"` | |
} | |
type Database struct { | |
Mode string | |
Role string | |
Password string | |
Host string | |
Port uint32 | |
DatabaseName string | |
EmbeddedPostgresRuntimePath string | |
} | |
type AquametaUser struct { | |
Name string | |
Email string | |
} | |
// TODO: This belongs in the database | |
type HTTPServer struct { | |
Protocol string | |
IP string | |
Port string | |
SSLCertificateFile string | |
SSLKeyFile string | |
StartupURL string | |
} | |
func getConfig(configFile string) (tomlConfig, error) { | |
var config tomlConfig | |
if _, err := toml.DecodeFile(configFile, &config); err != nil { | |
return config, err | |
} | |
return config, nil | |
} |