Use config_export function instead of calling dokku as a subcommand

This commit is contained in:
Jose Diaz-Gonzalez
2015-08-30 01:55:14 -04:00
parent cddc4afcea
commit e7c035e207
8 changed files with 40 additions and 21 deletions

17
plugins/config/functions Normal file
View 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
}