Browse Source

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

pull/843/merge
Jordan Wright 4 years ago
parent
commit
ca1e52148b
3 changed files with 19 additions and 4 deletions
  1. +1
    -0
      VERSION
  2. +5
    -3
      config/config.go
  3. +13
    -1
      gophish.go

+ 1
- 0
VERSION View File

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

+ 5
- 3
config/config.go View File

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

+ 13
- 1
gophish.go View File

@ -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…
Cancel
Save