mirror of https://github.com/gophish/gophish
Added config.json CLI flag: --config
parent
17bf53a6e2
commit
772fe28c06
|
@ -37,9 +37,9 @@ var Conf Config
|
||||||
// Version contains the current gophish version
|
// Version contains the current gophish version
|
||||||
var Version = "0.3"
|
var Version = "0.3"
|
||||||
|
|
||||||
func init() {
|
func LoadConfig(filepath string) {
|
||||||
// Get the config file
|
// Get the config file
|
||||||
config_file, err := ioutil.ReadFile("./config.json")
|
config_file, err := ioutil.ReadFile(filepath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("File error: %v\n", err)
|
fmt.Printf("File error: %v\n", err)
|
||||||
}
|
}
|
||||||
|
|
11
gophish.go
11
gophish.go
|
@ -33,6 +33,8 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
"gopkg.in/alecthomas/kingpin.v2"
|
||||||
|
|
||||||
"github.com/NYTimes/gziphandler"
|
"github.com/NYTimes/gziphandler"
|
||||||
"github.com/gophish/gophish/auth"
|
"github.com/gophish/gophish/auth"
|
||||||
"github.com/gophish/gophish/config"
|
"github.com/gophish/gophish/config"
|
||||||
|
@ -42,9 +44,16 @@ import (
|
||||||
"github.com/gorilla/handlers"
|
"github.com/gorilla/handlers"
|
||||||
)
|
)
|
||||||
|
|
||||||
var Logger = log.New(os.Stdout, " ", log.Ldate|log.Ltime|log.Lshortfile)
|
var (
|
||||||
|
Logger = log.New(os.Stdout, " ", log.Ldate|log.Ltime|log.Lshortfile)
|
||||||
|
|
||||||
|
configPath = kingpin.Flag("config", "Location of config.json.").Default("./config.json").String()
|
||||||
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
// Parse the CLI flags and load the config
|
||||||
|
kingpin.Parse()
|
||||||
|
config.LoadConfig(*configPath)
|
||||||
// Setup the global variables and settings
|
// Setup the global variables and settings
|
||||||
err := models.Setup()
|
err := models.Setup()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue