.okta.env file is actually a bash
Hello!
I'm not sure was intentional but okta apps create generates effectively sh-like file.
.env is key-value file format is very popular and has support pretty much in any language and docker
Expected behaviour
.env file is produced with format like:
KEY=VALUE
Current behaviour
.okta.env has format like:
export KEY=VALUE
Workarond
The generated file can be converted to .env by stipping export bit with simple command:
sed -i 's/^export //' .okta.env
Okta CLI version: 0.7.1-1f9781e
The current way sets environment variables if you run source .okta.env. If you changed to just KEY=VALUE, you'd have to have something that reads this file and converts this to environment variables. This looks interesting for Java apps: https://github.com/cdimascio/java-dotenv.
Part of me feels we should emit okta.bat with set instead of export for Windows. Particularly for Windows + Java users.
On the .NET side, it seems our .NET blog posts don't use environment variables. Instead, they rely on values in files. Maybe .NET is just not as sophisticated as Java. 😜
💯 I wish something like dotenv would be standard across all frameworks/libraries/langs
Here's another dotenv library that might work for Spring Boot. https://github.com/paulschwarz/spring-dotenv
I'm just not sure we could/should make that a requirement to use the cli.
Agreed. Could be something to try in a future post though.