okta-cli icon indicating copy to clipboard operation
okta-cli copied to clipboard

.okta.env file is actually a bash

Open ruXlab opened this issue 5 years ago • 6 comments

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

ruXlab avatar Nov 21 '20 18:11 ruXlab

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.

mraible avatar Nov 21 '20 20:11 mraible

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. 😜

mraible avatar Mar 12 '21 00:03 mraible

💯 I wish something like dotenv would be standard across all frameworks/libraries/langs

bdemers avatar Mar 24 '21 15:03 bdemers

Here's another dotenv library that might work for Spring Boot. https://github.com/paulschwarz/spring-dotenv

mraible avatar Mar 24 '21 15:03 mraible

I'm just not sure we could/should make that a requirement to use the cli.

bdemers avatar Mar 24 '21 15:03 bdemers

Agreed. Could be something to try in a future post though.

mraible avatar Mar 24 '21 15:03 mraible