Skip to content
Snippets Groups Projects
Commit 2db6f164 authored by Rhys Arkins's avatar Rhys Arkins
Browse files

refactor(bitbucket): username/password overwrite token

parent ebd81cd0
No related branches found
No related tags found
No related merge requests found
...@@ -89,16 +89,16 @@ async function parseConfigs(env, argv) { ...@@ -89,16 +89,16 @@ async function parseConfigs(env, argv) {
} }
const endpoint = config.endpoint || platformInfo.endpoint; const endpoint = config.endpoint || platformInfo.endpoint;
let token = config.token; let token = config.token;
if (!token) {
if (username && password) { if (username && password) {
logger.info('Using username and password to generate token');
const base64 = str => Buffer.from(str, 'binary').toString('base64'); const base64 = str => Buffer.from(str, 'binary').toString('base64');
token = base64(`${username}:${password}`); token = base64(`${username}:${password}`);
} else { }
if (!token) {
throw new Error( throw new Error(
`No authentication found for platform ${endpoint} (${platform})` `No authentication found for platform ${endpoint} (${platform})`
); );
} }
}
config.hostRules.push({ config.hostRules.push({
platform, platform,
endpoint, endpoint,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment