2014-01-09 06:42:05 +00:00
|
|
|
package config
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
"fmt"
|
|
|
|
"io/ioutil"
|
|
|
|
)
|
|
|
|
|
2016-01-17 16:45:13 +00:00
|
|
|
// AdminServer represents the Admin server configuration details
|
|
|
|
type AdminServer struct {
|
|
|
|
ListenURL string `json:"listen_url"`
|
|
|
|
UseTLS bool `json:"use_tls"`
|
|
|
|
CertPath string `json:"cert_path"`
|
|
|
|
KeyPath string `json:"key_path"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// PhishServer represents the Phish server configuration details
|
|
|
|
type PhishServer struct {
|
|
|
|
ListenURL string `json:"listen_url"`
|
|
|
|
UseTLS bool `json:"use_tls"`
|
|
|
|
CertPath string `json:"cert_path"`
|
|
|
|
KeyPath string `json:"key_path"`
|
|
|
|
}
|
|
|
|
|
2014-03-25 03:31:33 +00:00
|
|
|
// Config represents the configuration information.
|
|
|
|
type Config struct {
|
2016-01-19 03:13:32 +00:00
|
|
|
AdminConf AdminServer `json:"admin_server"`
|
|
|
|
PhishConf PhishServer `json:"phish_server"`
|
|
|
|
DBPath string `json:"db_path"`
|
|
|
|
MigrationsPath string `json:"migrations_path"`
|
2014-03-25 03:31:33 +00:00
|
|
|
}
|
|
|
|
|
2016-01-25 02:47:16 +00:00
|
|
|
// Conf contains the initialized configuration struct
|
2014-03-25 03:31:33 +00:00
|
|
|
var Conf Config
|
2014-01-09 06:42:05 +00:00
|
|
|
|
2016-08-06 23:58:34 +00:00
|
|
|
// Version contains the current gophish version
|
2016-11-19 04:17:26 +00:00
|
|
|
var Version = "0.3-dev"
|
2016-08-06 23:58:34 +00:00
|
|
|
|
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)
|
|
|
|
}
|