diff --git a/ia-upload-stream b/ia-upload-stream index 4136a58..ed0d5f0 100755 --- a/ia-upload-stream +++ b/ia-upload-stream @@ -41,15 +41,19 @@ class PreventCompletionError(UploadError): def get_ia_access_secret(configFile = None): if configFile is None: - # This part of the code is identical (except for style changes) to the one in internetarchive and was written from scratch by JustAnotherArchivist in May 2021. + # This part of the code is identical (except for style changes) to the one in internetarchive and was written from scratch by JustAnotherArchivist in May and December 2021. + candidates = [] + if os.environ.get('IA_CONFIG_FILE'): + candidates.append(os.environ['IA_CONFIG_FILE']) xdgConfigHome = os.environ.get('XDG_CONFIG_HOME') if not xdgConfigHome or not os.path.isabs(xdgConfigHome) or not os.path.isdir(xdgConfigHome): # Per the XDG Base Dir specification, this should be $HOME/.config. Unfortunately, $HOME does not exist on all systems. Therefore, we use ~/.config here. # On a POSIX-compliant system, where $HOME must always be set, the XDG spec will be followed precisely. xdgConfigHome = os.path.join(os.path.expanduser('~'), '.config') - for candidate in [os.path.join(xdgConfigHome, 'internetarchive', 'ia.ini'), - os.path.join(os.path.expanduser('~'), '.config', 'ia.ini'), - os.path.join(os.path.expanduser('~'), '.ia')]: + candidates.append(os.path.join(xdgConfigHome, 'internetarchive', 'ia.ini')) + candidates.append(os.path.join(os.path.expanduser('~'), '.config', 'ia.ini')) + candidates.append(os.path.join(os.path.expanduser('~'), '.ia')) + for candidate in candidates: if os.path.isfile(candidate): configFile = candidate break