pass the base directory to load the .env file

This commit is contained in:
Alfred Kamanda 2025-01-06 14:54:04 +03:00
parent 3ee15497a5
commit 79de0a9092
Signed by: Alfred-mk
GPG Key ID: 7EA3D01708908703
6 changed files with 27 additions and 18 deletions

View File

@ -14,6 +14,7 @@ import (
"git.defalsify.org/vise.git/engine" "git.defalsify.org/vise.git/engine"
"git.defalsify.org/vise.git/logging" "git.defalsify.org/vise.git/logging"
"git.defalsify.org/vise.git/resource" "git.defalsify.org/vise.git/resource"
testdataloader "github.com/peteole/testdata-loader"
"git.grassecon.net/urdt/ussd/config" "git.grassecon.net/urdt/ussd/config"
"git.grassecon.net/urdt/ussd/initializers" "git.grassecon.net/urdt/ussd/initializers"
@ -26,13 +27,14 @@ import (
var ( var (
logg = logging.NewVanilla().WithDomain("AfricasTalking").WithContextKey("at-session-id") logg = logging.NewVanilla().WithDomain("AfricasTalking").WithContextKey("at-session-id")
baseDir = testdataloader.GetBasePath()
scriptDir = path.Join("services", "registration") scriptDir = path.Join("services", "registration")
build = "dev" build = "dev"
menuSeparator = ": " menuSeparator = ": "
) )
func init() { func init() {
initializers.LoadEnvVariables() initializers.LoadEnvVariables(baseDir)
} }
func main() { func main() {
config.LoadConfig() config.LoadConfig()

View File

@ -12,6 +12,7 @@ import (
"git.defalsify.org/vise.git/engine" "git.defalsify.org/vise.git/engine"
"git.defalsify.org/vise.git/logging" "git.defalsify.org/vise.git/logging"
"git.defalsify.org/vise.git/resource" "git.defalsify.org/vise.git/resource"
testdataloader "github.com/peteole/testdata-loader"
"git.grassecon.net/urdt/ussd/config" "git.grassecon.net/urdt/ussd/config"
"git.grassecon.net/urdt/ussd/initializers" "git.grassecon.net/urdt/ussd/initializers"
@ -22,12 +23,13 @@ import (
var ( var (
logg = logging.NewVanilla() logg = logging.NewVanilla()
baseDir = testdataloader.GetBasePath()
scriptDir = path.Join("services", "registration") scriptDir = path.Join("services", "registration")
menuSeparator = ": " menuSeparator = ": "
) )
func init() { func init() {
initializers.LoadEnvVariables() initializers.LoadEnvVariables(baseDir)
} }
type asyncRequestParser struct { type asyncRequestParser struct {

View File

@ -14,6 +14,7 @@ import (
"git.defalsify.org/vise.git/engine" "git.defalsify.org/vise.git/engine"
"git.defalsify.org/vise.git/logging" "git.defalsify.org/vise.git/logging"
"git.defalsify.org/vise.git/resource" "git.defalsify.org/vise.git/resource"
testdataloader "github.com/peteole/testdata-loader"
"git.grassecon.net/urdt/ussd/config" "git.grassecon.net/urdt/ussd/config"
"git.grassecon.net/urdt/ussd/initializers" "git.grassecon.net/urdt/ussd/initializers"
@ -24,13 +25,14 @@ import (
) )
var ( var (
logg = logging.NewVanilla() logg = logging.NewVanilla()
scriptDir = path.Join("services", "registration") baseDir = testdataloader.GetBasePath()
scriptDir = path.Join("services", "registration")
menuSeparator = ": " menuSeparator = ": "
) )
func init() { func init() {
initializers.LoadEnvVariables() initializers.LoadEnvVariables(baseDir)
} }
func main() { func main() {

View File

@ -15,16 +15,18 @@ import (
"git.grassecon.net/urdt/ussd/internal/handlers" "git.grassecon.net/urdt/ussd/internal/handlers"
"git.grassecon.net/urdt/ussd/internal/storage" "git.grassecon.net/urdt/ussd/internal/storage"
"git.grassecon.net/urdt/ussd/remote" "git.grassecon.net/urdt/ussd/remote"
testdataloader "github.com/peteole/testdata-loader"
) )
var ( var (
logg = logging.NewVanilla() logg = logging.NewVanilla()
baseDir = testdataloader.GetBasePath()
scriptDir = path.Join("services", "registration") scriptDir = path.Join("services", "registration")
menuSeparator = ": " menuSeparator = ": "
) )
func init() { func init() {
initializers.LoadEnvVariables() initializers.LoadEnvVariables(baseDir)
} }
func main() { func main() {

View File

@ -9,22 +9,23 @@ import (
"path" "path"
"git.defalsify.org/vise.git/logging" "git.defalsify.org/vise.git/logging"
"git.grassecon.net/urdt/ussd/config"
"git.grassecon.net/urdt/ussd/internal/storage"
"git.grassecon.net/urdt/ussd/initializers"
"git.grassecon.net/urdt/ussd/common" "git.grassecon.net/urdt/ussd/common"
"git.grassecon.net/urdt/ussd/config"
"git.grassecon.net/urdt/ussd/initializers"
"git.grassecon.net/urdt/ussd/internal/storage"
testdataloader "github.com/peteole/testdata-loader"
) )
var ( var (
logg = logging.NewVanilla() logg = logging.NewVanilla()
baseDir = testdataloader.GetBasePath()
scriptDir = path.Join("services", "registration") scriptDir = path.Join("services", "registration")
) )
func init() { func init() {
initializers.LoadEnvVariables() initializers.LoadEnvVariables(baseDir)
} }
func main() { func main() {
config.LoadConfig() config.LoadConfig()
@ -75,5 +76,4 @@ func main() {
fmt.Fprintf(os.Stderr, err.Error()) fmt.Fprintf(os.Stderr, err.Error())
os.Exit(1) os.Exit(1)
} }
} }

View File

@ -7,24 +7,25 @@ import (
"os" "os"
"path" "path"
"git.grassecon.net/urdt/ussd/config"
"git.grassecon.net/urdt/ussd/initializers"
"git.grassecon.net/urdt/ussd/internal/storage"
"git.grassecon.net/urdt/ussd/debug"
"git.defalsify.org/vise.git/db" "git.defalsify.org/vise.git/db"
"git.defalsify.org/vise.git/logging" "git.defalsify.org/vise.git/logging"
"git.grassecon.net/urdt/ussd/config"
"git.grassecon.net/urdt/ussd/debug"
"git.grassecon.net/urdt/ussd/initializers"
"git.grassecon.net/urdt/ussd/internal/storage"
testdataloader "github.com/peteole/testdata-loader"
) )
var ( var (
logg = logging.NewVanilla() logg = logging.NewVanilla()
baseDir = testdataloader.GetBasePath()
scriptDir = path.Join("services", "registration") scriptDir = path.Join("services", "registration")
) )
func init() { func init() {
initializers.LoadEnvVariables() initializers.LoadEnvVariables(baseDir)
} }
func main() { func main() {
config.LoadConfig() config.LoadConfig()