fixing typo and adding message for retrieving API Token from file

This commit is contained in:
Samantha Marshall 2017-03-13 13:38:32 -04:00
commit ad869f9df6
No known key found for this signature in database
GPG key ID: DF782CB74434EFA2

View file

@ -52,12 +52,15 @@ proc getGithubAuth(cfg: Config): Auth =
if existsEnv(ApiTokenEnvironmentVariable): if existsEnv(ApiTokenEnvironmentVariable):
result.token = getEnv(ApiTokenEnvironmentVariable) result.token = getEnv(ApiTokenEnvironmentVariable)
display("Info:", "Using the '" & ApiTokenEnvironmentVariable & display("Info:", "Using the '" & ApiTokenEnvironmentVariable &
"' environment varaible for the GitHub API Token.", "' environment variable for the GitHub API Token.",
priority = HighPriority) priority = HighPriority)
else: else:
# try to read from disk, if it cannot be found write a new one # try to read from disk, if it cannot be found write a new one
try: try:
result.token = readFile(cfg.nimbleDir / ApiKeyFile) let api_token_file_path = cfg.nimbleDir / ApiKeyFile
result.token = readFile(api_token_file_path)
display("Info:", "Using GitHub API Token in file: " & api_token_file_path,
priority = HighPriority)
except IOError: except IOError:
result.token = requestNewToken(cfg) result.token = requestNewToken(cfg)