Skip to content

Commit b65e499

Browse files
author
Matthew Fisher
committed
fix(controller): inject config on top of existing environment
1 parent f1b3834 commit b65e499

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

controller/registry/private.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def publish_release(source, config, target):
5959
image['id'] = _new_id()
6060
config['DEIS_APP'] = target_image
6161
config['DEIS_RELEASE'] = target_tag
62-
image['config']['Env'] = _construct_env(config)
62+
image['config']['Env'] = _construct_env(image['config']['Env'], config)
6363
# update and tag the new image
6464
_commit(target_image, image, _empty_tar_archive(), target_tag)
6565

@@ -162,10 +162,17 @@ def _put_tag(image_id, repository_path, tag):
162162

163163
# utility functions
164164

165-
def _construct_env(config):
165+
def _construct_env(env, config):
166166
"Update current environment with latest config"
167167
new_env = []
168-
# add config ENV items
168+
# see if we need to update existing ENV vars
169+
for e in env:
170+
k, v = e.split('=', 1)
171+
if k in config:
172+
# update values defined by config
173+
v = config.pop(k)
174+
new_env.append("{}={}".format(encode(k), encode(v)))
175+
# add other config ENV items
169176
for k, v in config.items():
170177
new_env.append("{}={}".format(encode(k), encode(v)))
171178
return new_env

0 commit comments

Comments
 (0)