All files / src Env.ts

0% Statements 0/22
0% Branches 0/1
0% Functions 0/1
0% Lines 0/22

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23                                             
import { LogLevel } from "bunyan";
import { getLogLevel, getStringValue, LoggerOption, SecretString } from "lib";

export class Env implements LoggerOption {
  readonly appName: string;
  readonly logLevel: LogLevel;
  readonly slackLogLevel: LogLevel;
  readonly slackWebhookUrl: string;
  readonly dbUrlForPrisma: string;
  readonly encryptionPassword: SecretString;

  constructor(env: NodeJS.ProcessEnv) {
    this.appName = getStringValue(env, "APP_NAME");
    this.logLevel = getLogLevel(env, "LOG_LEVEL");
    this.slackLogLevel = getLogLevel(env, "SLACK_LOG_LEVEL");
    this.slackWebhookUrl = getStringValue(env, "SLACK_WEBHOOK_URL");
    this.dbUrlForPrisma = getStringValue(env, "DB_URL_FOR_PRISMA");
    this.encryptionPassword = new SecretString(
      getStringValue(env, "ENCRYPTION_PASSWORD")
    );
  }
}