Compare commits
No commits in common. "7a44f2ede71fa8659aa3468d672da514abbeff11" and "b5f6b2f413395783dff054be6168e291470d0c45" have entirely different histories.
7a44f2ede7
...
b5f6b2f413
2 changed files with 1 additions and 13 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,6 +1,5 @@
|
||||||
.air.toml
|
.air.toml
|
||||||
.env
|
.env
|
||||||
.env-dev
|
|
||||||
tmp/*
|
tmp/*
|
||||||
logs/*
|
logs/*
|
||||||
!logs/.gitkeep
|
!logs/.gitkeep
|
||||||
|
|
13
main.go
13
main.go
|
@ -26,25 +26,14 @@ var resources embed.FS
|
||||||
func main() {
|
func main() {
|
||||||
app := core.New()
|
app := core.New()
|
||||||
basePath, err := os.Getwd()
|
basePath, err := os.Getwd()
|
||||||
runMode := "dev"
|
|
||||||
if len(os.Args) > 1 {
|
|
||||||
if os.Args[1] == "prod" || os.Args[1] == "dev" {
|
|
||||||
runMode = os.Args[1]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal("error getting current working dir")
|
log.Fatal("error getting current working dir")
|
||||||
}
|
}
|
||||||
app.SetBasePath(basePath)
|
app.SetBasePath(basePath)
|
||||||
app.SetRunMode(runMode)
|
|
||||||
app.MakeDirs("logs", "storage", "storage/sqlite", "tls")
|
app.MakeDirs("logs", "storage", "storage/sqlite", "tls")
|
||||||
// Handle the reading of the .env file
|
// Handle the reading of the .env file
|
||||||
if config.GetEnvFileConfig().UseDotEnvFile {
|
if config.GetEnvFileConfig().UseDotEnvFile {
|
||||||
envfile := ".env-dev"
|
envVars, err := godotenv.Read(".env")
|
||||||
if runMode == "prod" {
|
|
||||||
envfile = ".env"
|
|
||||||
}
|
|
||||||
envVars, err := godotenv.Read(envfile)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal("Error loading .env file")
|
log.Fatal("Error loading .env file")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue