fix: reference env from config dir

This commit is contained in:
Jose Diaz-Gonzalez
2024-03-14 02:52:16 -04:00
parent b8accfd463
commit 38c6b180af
5 changed files with 18 additions and 17 deletions

View File

@@ -2,6 +2,7 @@ package config
import (
"os"
"path/filepath"
"strings"
"testing"
@@ -12,9 +13,9 @@ import (
var (
testAppName = "test-app-1"
dokkuRoot = common.MustGetEnv("DOKKU_ROOT")
testAppDir = strings.Join([]string{dokkuRoot, testAppName}, "/")
globalConfigFile = strings.Join([]string{dokkuRoot, "ENV"}, "/")
dokkuLibRoot = common.MustGetEnv("DOKKU_LIB_ROOT")
testAppDir = filepath.Join(dokkuLibRoot, "config", testAppName)
globalConfigFile = filepath.Join(dokkuLibRoot, "config", "--global", "ENV")
)
func setupTests() (err error) {

View File

@@ -392,9 +392,9 @@ func loadFromFileJSON(name string, filename string) (env *Env, err error) {
}, nil
}
func getAppFile(appName string) (string, error) {
return filepath.Join(common.MustGetEnv("DOKKU_ROOT"), appName, "ENV"), nil
return filepath.Join(common.MustGetEnv("DOKKU_LIB_ROOT"), "config", appName, "ENV"), nil
}
func getGlobalFile() string {
return filepath.Join(common.MustGetEnv("DOKKU_ROOT"), "ENV")
return filepath.Join(common.MustGetEnv("DOKKU_ROOT"), "config", "--global", "ENV")
}