2024-05-28 18:45:34 +02:00
|
|
|
import * as plugins from '../plugins.js';
|
|
|
|
import { Cloudly } from '../classes.cloudly.js';
|
2024-04-20 12:21:41 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* the portion of Cloudflare responsible
|
|
|
|
*/
|
|
|
|
export class CloudflareConnector {
|
|
|
|
private cloudlyRef: Cloudly;
|
|
|
|
public cloudflare: plugins.cloudflare.CloudflareAccount;
|
|
|
|
|
|
|
|
constructor(cloudlyArg: Cloudly) {
|
|
|
|
this.cloudlyRef = cloudlyArg;
|
|
|
|
}
|
|
|
|
|
|
|
|
// init the instance
|
|
|
|
public async init() {
|
2025-09-07 17:21:30 +00:00
|
|
|
const cloudflareToken = await this.cloudlyRef.settingsManager.getSetting('cloudflareToken');
|
|
|
|
|
|
|
|
if (!cloudflareToken) {
|
|
|
|
console.log('warn', 'No Cloudflare token configured in settings. Cloudflare features will be disabled.');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
this.cloudflare = new plugins.cloudflare.CloudflareAccount(cloudflareToken);
|
2024-04-20 12:21:41 +02:00
|
|
|
}
|
|
|
|
}
|