fix: reference env from config dir

This commit is contained in:
Jose Diaz-Gonzalez committed 2026-04-27 01:05:41 -04:00
1 parent b8accfd463
commit 38c6b180af
5 files changed
+18 -17

No files matched your search

+2 -2
View File
@@ -10,11 +10,11 @@ import (
var ( var (
testAppName = "test-app-1" testAppName = "test-app-1"
testAppDir = strings.Join([]string{"/home/dokku/", testAppName}, "") testAppDir = strings.Join([]string{"/var/lib/dokku/config/config/", testAppName}, "")
testEnvFile = strings.Join([]string{testAppDir, "/ENV"}, "") testEnvFile = strings.Join([]string{testAppDir, "/ENV"}, "")
testEnvLine = "export testKey=TESTING" testEnvLine = "export testKey=TESTING"
testAppName2 = "01-test-app-1" testAppName2 = "01-test-app-1"
testAppDir2 = strings.Join([]string{"/home/dokku/", testAppName2}, "") testAppDir2 = strings.Join([]string{"/var/lib/dokku/config/config/", testAppName2}, "")
testEnvFile2 = strings.Join([]string{testAppDir2, "/ENV"}, "") testEnvFile2 = strings.Join([]string{testAppDir2, "/ENV"}, "")
testEnvLine2 = "export testKey=TESTING" testEnvLine2 = "export testKey=TESTING"
) )
+4 -3
View File
@@ -2,6 +2,7 @@ package config
import ( import (
"os" "os"
"path/filepath"
"strings" "strings"
"testing" "testing"
@@ -12,9 +13,9 @@ import (
var ( var (
testAppName = "test-app-1" testAppName = "test-app-1"
dokkuRoot = common.MustGetEnv("DOKKU_ROOT") dokkuLibRoot = common.MustGetEnv("DOKKU_LIB_ROOT")
testAppDir = strings.Join([]string{dokkuRoot, testAppName}, "/") testAppDir = filepath.Join(dokkuLibRoot, "config", testAppName)
globalConfigFile = strings.Join([]string{dokkuRoot, "ENV"}, "/") globalConfigFile = filepath.Join(dokkuLibRoot, "config", "--global", "ENV")
) )
func setupTests() (err error) { func setupTests() (err error) {
+2 -2
View File
@@ -392,9 +392,9 @@ func loadFromFileJSON(name string, filename string) (env *Env, err error) {
}, nil }, nil
} }
func getAppFile(appName string) (string, error) { 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 { func getGlobalFile() string {
return filepath.Join(common.MustGetEnv("DOKKU_ROOT"), "ENV") return filepath.Join(common.MustGetEnv("DOKKU_ROOT"), "config", "--global", "ENV")
} }
+5 -5
View File
@@ -4,16 +4,16 @@ load test_helper
setup() { setup() {
global_setup global_setup
[[ -f ${DOKKU_ROOT}/ENV ]] && mv -f ${DOKKU_ROOT}/ENV ${DOKKU_ROOT}/ENV.bak mkdir -p "${DOKKU_LIB_ROOT}/config/--global"
sudo -H -u dokku /bin/bash -c "echo 'export global_test=true' > ${DOKKU_ROOT}/ENV" [[ -f ${DOKKU_LIB_ROOT}/config/--global/ENV ]] && mv -f ${DOKKU_LIB_ROOT}/config/--global/ENV ${DOKKU_LIB_ROOT}/config/--global/ENV.bak
sudo -H -u dokku /bin/bash -c "echo 'export global_test=true' > ${DOKKU_LIB_ROOT}/config/--global/ENV"
create_app create_app
} }
teardown() { teardown() {
destroy_app destroy_app
ls -la ${DOKKU_ROOT} if [[ -f ${DOKKU_LIB_ROOT}/config/--global/ENV.bak ]]; then
if [[ -f ${DOKKU_ROOT}/ENV.bak ]]; then mv -f ${DOKKU_LIB_ROOT}/config/--global/ENV.bak ${DOKKU_LIB_ROOT}/config/--global/ENV
mv -f ${DOKKU_ROOT}/ENV.bak ${DOKKU_ROOT}/ENV
fi fi
global_teardown global_teardown
} }
+5 -5
View File
@@ -4,16 +4,16 @@ load test_helper
setup() { setup() {
global_setup global_setup
[[ -f ${DOKKU_ROOT}/ENV ]] && mv -f ${DOKKU_ROOT}/ENV ${DOKKU_ROOT}/ENV.bak mkdir -p "${DOKKU_LIB_ROOT}/config/--global"
sudo -H -u dokku /bin/bash -c "echo 'export global_test=true' > ${DOKKU_ROOT}/ENV" [[ -f ${DOKKU_LIB_ROOT}/config/--global/ENV ]] && mv -f ${DOKKU_LIB_ROOT}/config/--global/ENV ${DOKKU_LIB_ROOT}/config/--global/ENV.bak
sudo -H -u dokku /bin/bash -c "echo 'export global_test=true' > ${DOKKU_LIB_ROOT}/config/--global/ENV"
create_app create_app
} }
teardown() { teardown() {
destroy_app destroy_app
ls -la ${DOKKU_ROOT} if [[ -f ${DOKKU_LIB_ROOT}/config/--global/ENV.bak ]]; then
if [[ -f ${DOKKU_ROOT}/ENV.bak ]]; then mv -f ${DOKKU_LIB_ROOT}/config/--global/ENV.bak ${DOKKU_LIB_ROOT}/config/--global/ENV
mv -f ${DOKKU_ROOT}/ENV.bak ${DOKKU_ROOT}/ENV
fi fi
global_teardown global_teardown
} }