fix(start supporting workers again): update
This commit is contained in:
@@ -8,7 +8,7 @@ import { ZoneManager } from './cloudflare.classes.zonemanager.js';
|
||||
|
||||
export class CloudflareAccount {
|
||||
private authToken: string;
|
||||
private accountIdentifier: string;
|
||||
public preselectedAccountId: string;
|
||||
|
||||
public workerManager = new WorkerManager(this);
|
||||
public zoneManager = new ZoneManager(this);
|
||||
@@ -26,7 +26,29 @@ export class CloudflareAccount {
|
||||
});
|
||||
}
|
||||
|
||||
public async preselectAccountByName(nameArg: string) {
|
||||
const accounts = await this.convenience.listAccounts();
|
||||
const account = accounts.find((accountArg) => {
|
||||
return accountArg.name === nameArg;
|
||||
});
|
||||
if (account) {
|
||||
this.preselectedAccountId = account.id;
|
||||
} else {
|
||||
throw new Error(`account with name ${nameArg} not found`);
|
||||
}
|
||||
}
|
||||
|
||||
public convenience = {
|
||||
/**
|
||||
* listAccounts
|
||||
*/
|
||||
listAccounts: async () => {
|
||||
const accounts: plugins.ICloudflareTypes['Account'][] = [];
|
||||
for await (const account of this.apiAccount.accounts.list()) {
|
||||
accounts.push(account as interfaces.ICloudflareApiAccountObject);
|
||||
}
|
||||
return accounts;
|
||||
},
|
||||
/**
|
||||
* gets a zone id of a domain from cloudflare
|
||||
* @param domainName
|
||||
|
||||
Reference in New Issue
Block a user