apache/openwhisk-runtime-dotnet

support init time parameters

rabbah opened this issue · 1 comments

At some point in the past we added support in OpenWhisk for init time parameters (these are “env” vars). See https://github.com/apache/openwhisk/blob/4babe39fd2dbcc900ccedb5a5e9561d301361205/tests/src/test/scala/actionContainers/BasicActionRunnerTests.scala#L125 

For backward compatibility, runtimes weren’t required to implement this. The .net 3.1 runtime doesn’t override the required function so that behavior is skipped https://github.com/apache/openwhisk-runtime-dotnet/blob/master/tests/src/test/scala/actionContainers/DotNet3_1ActionContainerTests.scala 

We should add this support to the runtime.

Chatting with @shawnallen85 he suggested a patch in proxy/Apache.OpenWhisk.Runtime.Common/Init.cs around line 73.

                if (message["env"] != null)
                {
                    Dictionary<string, string> dictEnv = message["env"].ToObject<Dictionary<string, string>>();
                    foreach(var key in dictEnv) {
                       System.Envrionment.SetEnvironmentVariable(key, dictEnv[key]);
                    }
                }

The current __OW_ context variables are set at runtime:

string envKey = $"__OW_{token.Path.ToUpperInvariant()}";

which may require some adaptation as well.

EDIT: I don't think we'll need to adapt the runtime export.