adobe / aio-cli-plugin-app

Create, Build and Deploy Cloud Native Applications
Apache License 2.0
19 stars 35 forks source link

Support using wskprops and ow env variables #294

Open tmathern opened 4 years ago

tmathern commented 4 years ago

Expected Behaviour

When working with a lot of components that get deployed to the same namespace, I would expect to be able to rely on using my settings file or OW env variables. So they I don't have to deal with updating env files so that they are in sync.

Another reason is that I may deploy the same action to different namespace (e.g. my own dev namespace, dev, stage and prod). I would also like to be able to set env variables for Apache OpenWhisk only once in my bash terminal, instead of constantly changing the .env files.

Actual Behaviour

Uses .env file to choose environment to deploy to.

Reproduce Scenario (including but not limited to)

Run aio app deploy.

Steps to Reproduce

Run aio app deploy.

Platform and Version

Latest (master), on mac os.

Sample Code that illustrates the problem

N/A, it needs new code.

Logs taken while reproducing problem

N/A

purplecabbage commented 4 years ago

If you set your global config values, you can use them in this way.

aio config set runtime.auth <auth-token>
aio config set runtime.namespace <namespace>

These values will be used anywhere that you run a command that looks for AIO_RUNTIME_AUTH and AIO_RUNTIME_NAMESPACE respectively.
If values are present in the .env they will be used, otherwise the global config values will be, similar to the way a .npmrc file works.

To see config values coming from environment variables:

aio config -e | --env

To see local config values, coming from a .aio file in the cwd

aio config -l | --local

To see global config values

aio config -g | --global

Additionally, you can run aio config --verbose which will show you all values, and where they come from.

tmathern commented 4 years ago

Well, I'm not interested that much in AIO env variables here, but really using the Openwhisk ones. That would help me use "usual" additional tooling which relies on OW env var, rather than aio ones...

purplecabbage commented 4 years ago

env variables are no different than AIO env variables, that line is very blurry. If you use aio runtime ... commands it will fall back to ~/.wskprops file values, is this what you want in the context of aio app ... commands?

tmathern commented 4 years ago

Exactly that, but not only. There is also the option to set the wskprops file location in an env var: WSK_CONFIG_FILE. That's the way we change/set our current environment in nui during dev and deploy.