Skip to content

Commit

Permalink
Changes nginx lua code to pass env vars through to docker containers
Browse files Browse the repository at this point in the history
  • Loading branch information
sychan committed Jun 20, 2018
1 parent d4c146b commit cc10984
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion docker/docker.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@
local M = {}
local Spore = require('Spore')
local json = require('json')
local os = require("os")
local narrEnvVars = os.getenv("NARR_ENV_VARS")

-- Define a clientEnv variable that is passed as environment to the containers being
-- started. The granularity of this kind of sucks, but it is only a stopgap until we
-- eliminate this code from KBase.
local clientEnv
if narrEnvVars == nil then
clientEnv = json.util.null
else
clientEnv = json.decode( narrEnvVars)
end

-- For creating new containers the config object must contain certain fields
-- Example config contains:
Expand All @@ -26,7 +38,7 @@ local function config()
Tty = false,
OpenStdin = false,
StdinOnce = false,
Env = json.util.null,
Env = clientEnv,
Cmd = {'/bin/bash'},
Dns = json.util.null,
Image = "base",
Expand Down

0 comments on commit cc10984

Please sign in to comment.