Loan .env from bin path
This commit is contained in:
parent
7c03492676
commit
540eef981f
11
main.go
11
main.go
@ -12,15 +12,20 @@ import (
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"stuzer.link/monobank-firefly3-bot/app"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// load .env
|
||||
err := godotenv.Load(".env")
|
||||
// Get executable directory
|
||||
exePath, err := os.Executable()
|
||||
if err != nil {
|
||||
log.Fatalf("error loading .env file")
|
||||
log.Fatal("Error getting executable path:", err)
|
||||
}
|
||||
exeDir := filepath.Dir(exePath)
|
||||
|
||||
// load .env
|
||||
godotenv.Load(filepath.Join(exeDir, ".env"))
|
||||
|
||||
// init app
|
||||
app.Init()
|
||||
|
Loading…
x
Reference in New Issue
Block a user