Skip to content

Commit 397d16f

Browse files
authored
fix(core): load SCW_PROFILE for default profile name (#98)
1 parent 4d72da4 commit 397d16f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

scaleway-core/scaleway_core/profile/env.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
ENV_KEY_SCW_CONFIG_PATH = "SCW_CONFIG_PATH"
2+
ENV_KEY_SCW_PROFILE = "SCW_PROFILE"
23
ENV_KEY_SCW_ACCESS_KEY = "SCW_ACCESS_KEY"
34
ENV_KEY_SCW_SECRET_KEY = "SCW_SECRET_KEY" # nosec B105
45
ENV_KEY_SCW_API_URL = "SCW_API_URL"

scaleway-core/scaleway_core/profile/profile.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@
77
from typing import Optional, Type, TypeVar
88

99
import yaml
10-
1110
from scaleway_core import __version__
1211
from scaleway_core.profile.file import CONFIG_PROPERTIES_TO_PROFILE
1312

14-
from .env import ENV_KEY_SCW_CONFIG_PATH, ENV_VARIABLES_TO_PROFILE
13+
from .env import ENV_KEY_SCW_CONFIG_PATH, ENV_KEY_SCW_PROFILE, ENV_VARIABLES_TO_PROFILE
1514

1615

1716
@dataclass
@@ -176,7 +175,7 @@ def from_config_file(
176175
def from_config_file_and_env(
177176
cls: Type[ProfileSelf],
178177
filepath: Optional[str] = None,
179-
profile_name: Optional[str] = "default",
178+
profile_name: Optional[str] = os.environ.get(ENV_KEY_SCW_PROFILE, "default"),
180179
) -> ProfileSelf:
181180
"""
182181
Loads profile from a config file and environment variables.

0 commit comments

Comments
 (0)