public generateConfig()

in monitoring/src/config.ts [69:102]


	public generateConfig(): void {
		// If no jurisdiction assign using aws region (Scheduled)
		if (!this._jurisdiction && this._awsRegion) {
			this._jurisdiction = ConfigHelper.getJurisdiction(this._awsRegion);
			this._isRunningAdhoc = false;
			log_info(`Generating config for scheduled trigger`);
		}

		// If no aws Region assign using jurisdiction (Adhoc)
		if (!this._awsRegion && this._jurisdiction) {
			this._awsRegion = ConfigHelper.getRegion(this._jurisdiction);
			this._isRunningAdhoc = true;
			log_info(`Generating config for adhoc trigger`);
		}

		// If the Jurisdiction or Stage value is not in the enum then throw an error
		if (
			!Validator.isStageJurisdiction(this._jurisdiction) ||
			!Validator.isStageValid(this._stage)
		) {
			const j = this._jurisdiction ? this._jurisdiction : 'missing';
			const r = this._awsRegion ? this._awsRegion : 'missing';
			throw `No config found for (env)stage: ${this._stage}, (env)jurisdiction: ${j}, (env)aws-region: ${r}`;
		}

		// Get the appropriate config
		this._config = ConfigBuilder.construct(
			<Stage>this._stage.toLowerCase(),
			<Jurisdiction>this._jurisdiction,
			this._awsRegion,
			this.isRunningAdhoc,
			<Stage>this._platform
		);
	}