|
169 | 169 | -- returns an empty table if the section does not exist
|
170 | 170 | local function load_file(filename, section)
|
171 | 171 | assert(type(filename) == "string", "expected filename to be a string")
|
172 |
| - if not pl_path.isfile(filename) then |
| 172 | + if not pl_path.isfile(pl_path.expanduser(filename)) then |
173 | 173 | return nil, "not a file: '"..filename.."'"
|
174 | 174 | end
|
175 | 175 |
|
|
228 | 228 | -- table if the config file does not exist.
|
229 | 229 | -- @return options table as gotten from the configuration file, or nil+err.
|
230 | 230 | function config.load_config()
|
231 |
| - if not pl_path.isfile(env_vars.AWS_CONFIG_FILE.value) then |
| 231 | + if not pl_path.isfile(pl_path.expanduser(env_vars.AWS_CONFIG_FILE.value)) then |
232 | 232 | -- file doesn't exist
|
233 | 233 | return {}
|
234 | 234 | end
|
|
243 | 243 | -- @return credentials table as gotten from the credentials file, or a table
|
244 | 244 | -- with the key, id, and token from the configuration file, table can be empty.
|
245 | 245 | function config.load_credentials()
|
246 |
| - if pl_path.isfile(env_vars.AWS_SHARED_CREDENTIALS_FILE.value) then |
| 246 | + if pl_path.isfile(pl_path.expanduser(env_vars.AWS_SHARED_CREDENTIALS_FILE.value)) then |
247 | 247 | local creds = config.load_credentials_file(env_vars.AWS_SHARED_CREDENTIALS_FILE.value, env_vars.AWS_PROFILE.value)
|
248 | 248 | if creds then -- ignore error, already logged
|
249 | 249 | return creds
|
|
279 | 279 | function config.get_config()
|
280 | 280 | local cfg = config.load_config() or {} -- ignore error, already logged
|
281 | 281 |
|
282 |
| - if pl_path.isfile(env_vars.AWS_SHARED_CREDENTIALS_FILE.value) then |
| 282 | + if pl_path.isfile(pl_path.expanduser(env_vars.AWS_SHARED_CREDENTIALS_FILE.value)) then |
283 | 283 | -- there is a creds file, so override creds with creds file
|
284 | 284 | local creds = config.load_credentials_file(
|
285 | 285 | env_vars.AWS_SHARED_CREDENTIALS_FILE.value, env_vars.AWS_PROFILE.value) -- ignore error, already logged
|
|
0 commit comments