Skip to content

Commit

Permalink
fix(http): let client decide http(s) version to use
Browse files Browse the repository at this point in the history
  • Loading branch information
awlayton committed Feb 12, 2023
1 parent 6904757 commit 3575c31
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 12 deletions.
7 changes: 0 additions & 7 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,6 @@ const config = convict({
env: 'DOMAIN',
arg: 'domain',
},
mode: {
doc: 'Specific HTTP or HTTPS for OADA API connection',
format: ['http', 'https'],
default: 'https' as 'http' | 'https',
env: 'HTTP_MODE',
arg: 'mode',
},
token: {
doc: 'OADA API token',
format: Array,
Expand Down
3 changes: 1 addition & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ const fatal = debug('unfisk:fatal');

// Tolerant of https or not https on domain
const domain = config.get('oada.domain').replace(/^https?:\/\//, '');
const mode = config.get('oada.mode');
const tokens = config.get('oada.token');
const flat = config.get('lists.flat');
const unflat = config.get('lists.unflat'); // Day-index will be added to this
Expand All @@ -51,7 +50,7 @@ async function unfisk(token: string) {
// Connect to the OADA API
const conn = oada
? oada.clone(token)
: (oada = await connect({ token, domain: `${mode}://${domain}` }));
: (oada = await connect({ token, domain }));

await ensureAllPathsExist(conn);

Expand Down
5 changes: 2 additions & 3 deletions test/external.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,15 @@ import testasn from './testasn.js';

// DO NOT include ../ because we are testing externally.

const domain = config.get('oada.domain').replace(/^https?:\/\//, '');
const mode = config.get('oada.mode');
const domain = config.get('oada.domain');
const token = config.get('oada.token')[0]!;

const asnKey = 'UNFISK_TEST_ASN1';
const asnID = `resources/${asnKey}`;

let conn: OADAClient;
test.before(async () => {
conn = await connect({ token, domain: `${mode}://${domain}` });
conn = await connect({ token, domain });
});

test.after(async () => {
Expand Down

0 comments on commit 3575c31

Please sign in to comment.