fix(core): update
This commit is contained in:
parent
e0614b5956
commit
bc4cae3333
6
package-lock.json
generated
6
package-lock.json
generated
@ -933,9 +933,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"js-base64": {
|
||||
"version": "2.5.1",
|
||||
"resolved": "https://verdaccio.lossless.one/js-base64/-/js-base64-2.5.1.tgz",
|
||||
"integrity": "sha512-M7kLczedRMYX4L8Mdh4MzyAMM9O5osx+4FcOQuTvr3A9F2D9S5JXheN0ewNbrvK2UatkTRhL5ejGmGSjNMiZuw=="
|
||||
"version": "2.5.2",
|
||||
"resolved": "https://verdaccio.lossless.one/js-base64/-/js-base64-2.5.2.tgz",
|
||||
"integrity": "sha512-Vg8czh0Q7sFBSUMWWArX/miJeBWYBPpdU/3M/DKSaekLMqrqVPaedp+5mZhie/r0lgrcaYBfwXatEew6gwgiQQ=="
|
||||
},
|
||||
"js-tokens": {
|
||||
"version": "4.0.0",
|
||||
|
@ -11,10 +11,7 @@ const randomPrefix = Math.floor(Math.random() * 2000);
|
||||
let testCloudflareAccount: cloudflare.CloudflareAccount;
|
||||
|
||||
tap.test('should create a valid instance of CloudflareAccount', async () => {
|
||||
testCloudflareAccount = new cloudflare.CloudflareAccount({
|
||||
email: testQenv.getEnvVarOnDemand('CF_EMAIL'),
|
||||
key: testQenv.getEnvVarOnDemand('CF_KEY')
|
||||
});
|
||||
testCloudflareAccount = new cloudflare.CloudflareAccount(testQenv.getEnvVarOnDemand('CF_KEY'));
|
||||
});
|
||||
|
||||
tap.test('.listZones() -> should display an entire account', async tools => {
|
||||
|
@ -6,8 +6,7 @@ import { WorkerManager } from './cloudflare.classes.workermanager';
|
||||
import { ZoneManager } from './cloudflare.classes.zonemanager';
|
||||
|
||||
export class CloudflareAccount {
|
||||
private authEmail: string;
|
||||
private authKey: string;
|
||||
private authToken: string;
|
||||
private accountIdentifier: string;
|
||||
|
||||
public workerManager = new WorkerManager(this);
|
||||
@ -17,9 +16,8 @@ export class CloudflareAccount {
|
||||
* constructor sets auth information on the CloudflareAccountInstance
|
||||
* @param optionsArg
|
||||
*/
|
||||
constructor(optionsArg: { email: string; key: string }) {
|
||||
this.authEmail = optionsArg.email;
|
||||
this.authKey = optionsArg.key;
|
||||
constructor(authTokenArg: string) {
|
||||
this.authToken = authTokenArg
|
||||
}
|
||||
|
||||
/**
|
||||
@ -192,8 +190,7 @@ export class CloudflareAccount {
|
||||
method: methodArg,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-Auth-Email': this.authEmail,
|
||||
'X-Auth-Key': this.authKey,
|
||||
'Authorization': `Bearer ${this.authToken}`,
|
||||
'Content-Length': Buffer.byteLength(JSON.stringify(dataArg)),
|
||||
...requestHeadersArg
|
||||
},
|
||||
@ -237,6 +234,6 @@ export class CloudflareAccount {
|
||||
}
|
||||
|
||||
private authCheck() {
|
||||
return this.authEmail && this.authKey; // check if auth is available
|
||||
return !!this.authToken; // check if auth is available
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user