Adding VERSION file and bumping version to 0.4-dev. Fixes #742

pull/843/merge
Jordan Wright 2017-09-05 21:54:32 -05:00
parent 28b802254b
commit ca1e52148b
3 changed files with 19 additions and 4 deletions

1
VERSION Normal file
View File

@ -0,0 +1 @@
0.4-dev

View File

@ -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
} }

View File

@ -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)
} }