@@ -14,6 +14,10 @@ inputs:
1414 description : " Environment variables deploy as config. Format: 'VAR1 VAR2 VAR3'"
1515 required : false
1616 default : " "
17+ config-vars-init-random :
18+ description : " Initialize config variables in this list with random values if they are not already set. Format: 'VAR1 VAR2 VAR3'"
19+ required : false
20+ default : " "
1721 command :
1822 description : " The command to run."
1923 required : false
@@ -90,20 +94,28 @@ runs:
9094 echo "Some Defang config vars do not have values. To use Github Secrets, add"
9195 echo "these variables to your environment:"
9296 for source in "${empty[@]}"; do
93- echo "- $source"
97+ if [[ " $CONFIG_ENV_VARS_INIT_RANDOM " != *" $source "* ]]; then
98+ echo "- $source"
99+ fi
94100 done
95101 echo "Here is a link to your repository environments settings:"
96102 echo "https://github.com/${GITHUB_REPOSITORY}/settings/environments"
97103 fi
98104 for source in $CONFIG_ENV_VARS; do
99105 echo "Updating $source"
100- echo defang config "${params[@]}" set -e $source
101- defang config "${params[@]}" set -e $source
106+ if [[ " $CONFIG_ENV_VARS_INIT_RANDOM " == *" $source "* ]]; then
107+ echo defang config "${params[@]}" --init --random -e $source
108+ defang config "${params[@]}" --init --random -e $source
109+ else
110+ echo defang config "${params[@]}" set -e $source
111+ defang config "${params[@]}" set -e $source
112+ fi
102113 done
103114 working-directory : ${{ inputs.cwd }}
104115 env :
105116 COMPOSE_FILES : ${{ inputs['compose-files'] }}
106117 CONFIG_ENV_VARS : ${{ inputs['config-env-vars'] }}
118+ CONFIG_ENV_VARS_INIT_RANDOM : ${{ inputs['config-vars-init-random'] }}
107119
108120 - name : Defang ${{ inputs['command'] }}
109121 if : ${{ inputs['command'] != '' }}
0 commit comments