Remove env path hardcode
This commit is contained in:
parent
66fdae2832
commit
f1e987f4b8
9
main.go
9
main.go
@ -2,20 +2,15 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
|
||||||
"path/filepath"
|
|
||||||
"runtime"
|
|
||||||
|
|
||||||
"gitea.stuzer.link/stuzer05/docker-registry-manager/cmd"
|
"gitea.stuzer.link/stuzer05/docker-registry-manager/cmd"
|
||||||
"gitea.stuzer.link/stuzer05/docker-registry-manager/internal/app"
|
"gitea.stuzer.link/stuzer05/docker-registry-manager/internal/app"
|
||||||
|
|
||||||
"github.com/joho/godotenv"
|
"github.com/joho/godotenv"
|
||||||
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
// Load .env file
|
// Load .env file
|
||||||
_, b, _, _ := runtime.Caller(0)
|
err := godotenv.Load()
|
||||||
err := godotenv.Load(filepath.Join(filepath.Dir(b), ".env"))
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("Error loading .env file:", err)
|
fmt.Println("Error loading .env file:", err)
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user