mirror of
https://github.com/gophish/gophish
synced 2024-11-14 16:27:23 +00:00
Added config.json CLI flag: --config
This commit is contained in:
parent
17bf53a6e2
commit
772fe28c06
2 changed files with 12 additions and 3 deletions
|
@ -37,9 +37,9 @@ var Conf Config
|
|||
// Version contains the current gophish version
|
||||
var Version = "0.3"
|
||||
|
||||
func init() {
|
||||
func LoadConfig(filepath string) {
|
||||
// Get the config file
|
||||
config_file, err := ioutil.ReadFile("./config.json")
|
||||
config_file, err := ioutil.ReadFile(filepath)
|
||||
if err != nil {
|
||||
fmt.Printf("File error: %v\n", err)
|
||||
}
|
||||
|
|
11
gophish.go
11
gophish.go
|
@ -33,6 +33,8 @@ import (
|
|||
"os"
|
||||
"sync"
|
||||
|
||||
"gopkg.in/alecthomas/kingpin.v2"
|
||||
|
||||
"github.com/NYTimes/gziphandler"
|
||||
"github.com/gophish/gophish/auth"
|
||||
"github.com/gophish/gophish/config"
|
||||
|
@ -42,9 +44,16 @@ import (
|
|||
"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() {
|
||||
// Parse the CLI flags and load the config
|
||||
kingpin.Parse()
|
||||
config.LoadConfig(*configPath)
|
||||
// Setup the global variables and settings
|
||||
err := models.Setup()
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in a new issue