Skip to content

Commit 5c3d545

Browse files
committed
fix(credential): Check for credential file in working dir before home dir
1 parent 8fee5bf commit 5c3d545

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

ibm_cloud_sdk_core/utils.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,16 +111,16 @@ def read_from_credential_file(service_name, separator='='):
111111
# File path specified by an env variable
112112
credential_file_path = getenv('IBM_CREDENTIALS_FILE')
113113

114-
# Home directory
114+
# Top-level of the project directory
115115
if credential_file_path is None:
116-
file_path = join(expanduser('~'), DEFAULT_CREDENTIALS_FILE_NAME)
116+
file_path = join(
117+
dirname(dirname(abspath(__file__))), DEFAULT_CREDENTIALS_FILE_NAME)
117118
if isfile(file_path):
118119
credential_file_path = file_path
119120

120-
# Top-level of the project directory
121+
# Home directory
121122
if credential_file_path is None:
122-
file_path = join(
123-
dirname(dirname(abspath(__file__))), DEFAULT_CREDENTIALS_FILE_NAME)
123+
file_path = join(expanduser('~'), DEFAULT_CREDENTIALS_FILE_NAME)
124124
if isfile(file_path):
125125
credential_file_path = file_path
126126

0 commit comments

Comments
 (0)