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
|
var Conf Config
|
||||||
|
|
||||||
// Version contains the current gophish version
|
// Version contains the current gophish version
|
||||||
var Version = "0.3"
|
var Version = ""
|
||||||
|
|
||||||
|
// LoadConfig loads the configuration from the specified filepath
|
||||||
func LoadConfig(filepath string) {
|
func LoadConfig(filepath string) {
|
||||||
// Get the config file
|
// Get the config file
|
||||||
config_file, err := ioutil.ReadFile(filepath)
|
configFile, err := ioutil.ReadFile(filepath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("File error: %v\n", err)
|
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.
|
// Choosing the migrations directory based on the database used.
|
||||||
Conf.MigrationsPath = Conf.MigrationsPath + Conf.DBName
|
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.
|
THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
import (
|
import (
|
||||||
|
"io/ioutil"
|
||||||
"compress/gzip"
|
"compress/gzip"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
@ -51,11 +52,22 @@ var (
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
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
|
// Parse the CLI flags and load the config
|
||||||
|
kingpin.CommandLine.HelpFlag.Short('h')
|
||||||
kingpin.Parse()
|
kingpin.Parse()
|
||||||
|
|
||||||
|
// Load the config
|
||||||
config.LoadConfig(*configPath)
|
config.LoadConfig(*configPath)
|
||||||
|
config.Version = string(version)
|
||||||
// Setup the global variables and settings
|
// Setup the global variables and settings
|
||||||
err := models.Setup()
|
err = models.Setup()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue