mirror of
https://github.com/dokku/dokku.git
synced 2025-12-29 00:25:08 +01:00
feat: add json output to config:export
This change adds json output as both key/value as well as a list of objects. The former can be used in quick scripting environments, while the latter allows higher-level languages to have a bit more structure around how environment variables are declared. Specifically, systems such as kubernetes understand the latter method, while the former can be used within Nomad job files.
This commit is contained in:
@@ -155,6 +155,32 @@ teardown() {
|
||||
run /bin/bash -c "dokku --app $TEST_APP config:show"
|
||||
echo "output: $output"
|
||||
echo "status: "$stat
|
||||
|
||||
assert_output "=====> $TEST_APP env vars"$'\nBKEY: true\naKey: true\nbKey: true\nzKey: true'
|
||||
}
|
||||
|
||||
@test "(config) config:export" {
|
||||
run /bin/bash -c "dokku --app $TEST_APP config:set zKey=true bKey=true BKEY=true aKey=true"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku config:export --format docker-args $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: "$stat
|
||||
assert_output "--env=BKEY='true' --env=aKey='true' --env=bKey='true' --env=zKey='true'"
|
||||
|
||||
run /bin/bash -c "dokku config:export --format shell $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: "$stat
|
||||
assert_output "BKEY='true' aKey='true' bKey='true' zKey='true' "
|
||||
|
||||
run /bin/bash -c "dokku config:export --format json $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: "$stat
|
||||
assert_output '{"BKEY":"true","aKey":"true","bKey":"true","zKey":"true"}'
|
||||
|
||||
run /bin/bash -c "dokku config:export --format json-list $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: "$stat
|
||||
assert_output '[{"name":"BKEY","value":"true"},{"name":"aKey","value":"true"},{"name":"bKey","value":"true"},{"name":"zKey","value":"true"}]'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user