mirror of https://github.com/gophish/gophish
Adding VERSION file and bumping version to 0.4-dev. Fixes #742
parent
28b802254b
commit
ca1e52148b
|
@ -35,15 +35,17 @@ type Config struct {
|
|||
var Conf Config
|
||||
|
||||
// Version contains the current gophish version
|
||||
var Version = "0.3"
|
||||
var Version = ""
|
||||
|
||||
// LoadConfig loads the configuration from the specified filepath
|
||||
func LoadConfig(filepath string) {
|
||||
// Get the config file
|
||||
config_file, err := ioutil.ReadFile(filepath)
|
||||
configFile, err := ioutil.ReadFile(filepath)
|
||||
if err != nil {
|
||||
fmt.Printf("File error: %v\n", err)
|
||||
}
|
||||
json.Unmarshal(config_file, &Conf)
|
||||
json.Unmarshal(configFile, &Conf)
|
||||
|
||||
// Choosing the migrations directory based on the database used.
|
||||
Conf.MigrationsPath = Conf.MigrationsPath + Conf.DBName
|
||||
}
|
||||
|
|
14
gophish.go
14
gophish.go
|
@ -26,6 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|||
THE SOFTWARE.
|
||||
*/
|
||||
import (
|
||||
"io/ioutil"
|
||||
"compress/gzip"
|
||||
"fmt"
|
||||
"log"
|
||||
|
@ -51,11 +52,22 @@ var (
|
|||
)
|
||||
|
||||
func main() {
|
||||
// Load the version
|
||||
version, err := ioutil.ReadFile("./VERSION")
|
||||
if err != nil {
|
||||
Logger.Fatalln(err)
|
||||
}
|
||||
kingpin.Version(string(version))
|
||||
|
||||
// Parse the CLI flags and load the config
|
||||
kingpin.CommandLine.HelpFlag.Short('h')
|
||||
kingpin.Parse()
|
||||
|
||||
// Load the config
|
||||
config.LoadConfig(*configPath)
|
||||
config.Version = string(version)
|
||||
// Setup the global variables and settings
|
||||
err := models.Setup()
|
||||
err = models.Setup()
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue