Genera
Class field decorator @EnvironmentVariable
. Depends on TypeScript 5, Stage 3 ECMAScript Decorators
and does not requires the opt-in compiler flag called --experimentalDecorators
.
export default class AwsEnvironment {
@EnvironmentVariable.of("AWS_REGION").orElseInitial()
private readonly awsRegion: string = "us-east-1";
@EnvironmentVariable.of("AWS_ACCOUNT").orElseThrow()
private readonly awsAccount: string = "";
public region(): string {
return this.awsRegion;
}
public account(): string {
return this.awsAccount;
}
}
Install:
% npm i @raccoons-co/genera