Re-add support for github-access-token, but mark as deprecated.

This commit is contained in:
Kevin Quick 2020-09-25 08:09:56 -07:00
parent ef2a14be19
commit 5a35cc29bf
No known key found for this signature in database
GPG key ID: E6D7733599CC0A21
2 changed files with 11 additions and 1 deletions

View file

@ -146,7 +146,17 @@ struct GitArchiveInputScheme : InputScheme
auto tokens = settings.accessTokens.get(); auto tokens = settings.accessTokens.get();
auto pat = tokens.find(host); auto pat = tokens.find(host);
if (pat == tokens.end()) if (pat == tokens.end())
{
if ("github.com" == host)
{
auto oldcfg = settings.githubAccessToken.get();
if (!oldcfg.empty()) {
warn("using deprecated 'github-access-token' config value; please use 'access-tokens' instead");
return oldcfg;
}
}
return std::nullopt; return std::nullopt;
}
return pat->second; return pat->second;
} }

View file

@ -861,7 +861,7 @@ public:
)"}; )"};
Setting<std::string> githubAccessToken{this, "", "github-access-token", Setting<std::string> githubAccessToken{this, "", "github-access-token",
"GitHub access token to get access to GitHub data through the GitHub API for `github:<..>` flakes."}; "GitHub access token to get access to GitHub data through the GitHub API for `github:<..>` flakes (deprecated, please use 'access-tokens' instead)."};
Setting<StringMap> accessTokens{this, {}, "access-tokens", Setting<StringMap> accessTokens{this, {}, "access-tokens",
R"( R"(