Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions flow360/cli/api_set_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from click.testing import CliRunner

from flow360 import user_config
from flow360.cli.app import configure
from flow360.log import log

Expand All @@ -24,12 +25,18 @@ def configure_caller(apikey: str, environment: str = None, profile: str = "defau
args = ["--apikey", apikey, "--profile", profile]

if environment:
args += ["--env", environment]
if environment.lower() in ("dev", "uat"):
args += ["--" + environment.lower()]
elif environment.lower() == "prod":
args += []
else:
args += ["--env", environment]

# Invoke the `configure` command
result = runner.invoke(configure, args)

if result.exit_code != 0:
log.info("Error:" + result.output)
log.error(result.output if result.output else str(result.exception))
else:
log.info("Configuration successful.")
user_config.UserConfig = user_config.BasicUserConfig() # Reload
6 changes: 3 additions & 3 deletions flow360/cloud/security.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
Security related functions.
"""

from ..environment import Env
from ..user_config import UserConfig
from flow360 import user_config
from flow360.environment import Env


def api_key():
Expand All @@ -12,5 +12,5 @@ def api_key():
:return:
"""

apikey = UserConfig.apikey(Env.current)
apikey = user_config.UserConfig.apikey(Env.current)
return apikey