2014-01-09 06:42:05 +00:00
|
|
|
package config
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
"fmt"
|
|
|
|
"io/ioutil"
|
|
|
|
)
|
|
|
|
|
2014-03-25 03:31:33 +00:00
|
|
|
type SMTPServer struct {
|
|
|
|
Host string `json:"host"`
|
|
|
|
User string `json:"user"`
|
|
|
|
Password string `json:"password"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// Config represents the configuration information.
|
|
|
|
type Config struct {
|
2014-06-29 21:44:16 +00:00
|
|
|
AdminURL string `json:"admin_url"`
|
|
|
|
PhishURL string `json:"phish_url"`
|
|
|
|
SMTP SMTPServer `json:"smtp"`
|
|
|
|
DBPath string `json:"dbpath"`
|
2014-03-25 03:31:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
var Conf Config
|
2014-01-09 06:42:05 +00:00
|
|
|
|
|
|
|
func init() {
|
|
|
|
// Get the config file
|
|
|
|
config_file, err := ioutil.ReadFile("./config.json")
|
|
|
|
if err != nil {
|
|
|
|
fmt.Printf("File error: %v\n", err)
|
|
|
|
}
|
|
|
|
json.Unmarshal(config_file, &Conf)
|
|
|
|
}
|