2019-06-30 10:25:08 UTC - Adam Varsano: Hi, I've deployed openwhisk on kubernetes, how can I set environment variables to actions? https://openwhisk-team.slack.com/archives/C3TPCAQG1/p1561890308102300 ---- 2019-06-30 12:24:41 UTC - Rodric Rabbah: Hi @Adam Varsano you attach parameters to actions via the cli using the -p parameter. All parameters become input to the main function. https://openwhisk-team.slack.com/archives/C3TPCAQG1/p1561897481104100?thread_ts=1561897481.104100&cid=C3TPCAQG1 ---- 2019-06-30 12:26:02 UTC - Rodric Rabbah: Here’s a recent discussion on the Apache dev list that might be if interest given your question <https://lists.apache.org/thread.html/7e03e6fc965d972882f4c76e34b2e9aa28579a0c3004d63d546e2611@%3Cdev.openwhisk.apache.org%3E> https://openwhisk-team.slack.com/archives/C3TPCAQG1/p1561897562105000 ---- 2019-06-30 12:49:27 UTC - Adam Varsano: Hi, thanks for replying, you mean on creation of the actions I should pass -p parameter? https://openwhisk-team.slack.com/archives/C3TPCAQG1/p1561898967105100?thread_ts=1561897481.104100&cid=C3TPCAQG1 ---- 2019-06-30 12:54:26 UTC - Rodric Rabbah: yes `wsk action create actionName actionSourceFile -p MY_PARAM some_value` then you will see `{ MY_PARAM: some_value }` as the argument to your action’s main function. https://openwhisk-team.slack.com/archives/C3TPCAQG1/p1561899266105300?thread_ts=1561897481.104100&cid=C3TPCAQG1 ---- 2019-06-30 12:55:07 UTC - Rodric Rabbah: later you can `wsk action update actionName -p MY_PARAM some_value -p ANOTHER_PARAM some_value` to attach more parameters or change existing ones https://openwhisk-team.slack.com/archives/C3TPCAQG1/p1561899307105500?thread_ts=1561897481.104100&cid=C3TPCAQG1 ---- 2019-06-30 12:58:45 UTC - Adam Varsano: I found this library of env vars: <https://github.com/joho/godotenv>
usually you get env vars by typing os.Getenv with your solution is it still work? https://openwhisk-team.slack.com/archives/C3TPCAQG1/p1561899525105900?thread_ts=1561897481.104100&cid=C3TPCAQG1 ---- 2019-06-30 13:00:05 UTC - Rodric Rabbah: not today because openwhisk does not export any parameters to the environment (the discussion on the dev list above would change that) you wouldn’t need godotenv since the parameters are directly available in your “main” function https://openwhisk-team.slack.com/archives/C3TPCAQG1/p1561899605106100?thread_ts=1561897481.104100&cid=C3TPCAQG1 ---- 2019-06-30 13:00:42 UTC - Rodric Rabbah: are you writing a go function? https://openwhisk-team.slack.com/archives/C3TPCAQG1/p1561899642106300?thread_ts=1561897481.104100&cid=C3TPCAQG1 ---- 2019-06-30 13:03:22 UTC - Rodric Rabbah: if so it would be something like ``` func Main(args map[string]interface{}) map[string]interface{} { MY_PARAM, _ := args["MY_PARAM"].(string) ... } ``` https://openwhisk-team.slack.com/archives/C3TPCAQG1/p1561899802106500?thread_ts=1561897481.104100&cid=C3TPCAQG1 ---- 2019-06-30 13:11:22 UTC - Adam Varsano: I'm writing go functions yes https://openwhisk-team.slack.com/archives/C3TPCAQG1/p1561900282106900?thread_ts=1561897481.104100&cid=C3TPCAQG1 ----