Use config_export function instead of calling dokku as a subcommand
This commit is contained in:
17
plugins/config/functions
Normal file
17
plugins/config/functions
Normal file
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_PATH/common/functions"
|
||||
|
||||
config_export() {
|
||||
local CONFIG_TYPE="$1"
|
||||
local APP="$2"
|
||||
local ENV_FILE="$DOKKU_ROOT/$APP/ENV"
|
||||
|
||||
[[ $CONFIG_TYPE == "global" ]] && ENV_FILE="$DOKKU_ROOT/ENV"
|
||||
[[ ! -f $ENV_FILE ]] && return 0
|
||||
[[ ! -s $ENV_FILE ]] && return 0
|
||||
|
||||
VARS=$(grep -Eo "export ([a-zA-Z_][a-zA-Z0-9_]*=.*)" $ENV_FILE | cut -d" " -f2-)
|
||||
echo "$VARS" | awk '{print "export " $0}'
|
||||
return 0
|
||||
}
|
||||
Reference in New Issue
Block a user