All files / src environment.ts

100% Statements 15/15
100% Branches 15/15
100% Functions 5/5
100% Lines 15/15

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 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 431x   1x     17x       172x 2x     170x       171x 1x     170x       171x 1x     170x       169x     168x   1x        
import ClientError from "./error";
 
export default class Environment {
 
    public static getMinLogLevel(): string {
        return process.env.MIN_LOG_LEVEL || "error";
    }
 
    public static getNextcloudUrl(): string {
        if (!process.env.NEXTCLOUD_URL) {
            throw new ClientError("NCEnvironment: NEXTCLOUD_URL not defined in environment"
                , "ERR_NEXTCLOUD_URL_NOT_DEFINED");
        }
        return process.env.NEXTCLOUD_URL;
    }
 
    public static getUserName(): string {
        if (!process.env.NEXTCLOUD_USERNAME) {
            throw new ClientError("NCEnvironment: NEXTCLOUD_USERNAME not defined in environment"
                , "ERR_NEXTCLOUD_USERNAME_NOT_DEFINED");
        }
        return process.env.NEXTCLOUD_USERNAME;
    }
 
    public static getPassword(): string {
        if (!process.env.NEXTCLOUD_PASSWORD) {
            throw new ClientError("NCEnvironment: NEXTCLOUD_PASSWORD not defined in environment"
                , "ERR_NEXTCLOUD_PASSWORD_NOT_DEFINED");
        }
        return process.env.NEXTCLOUD_PASSWORD;
    }
 
    public static getRecordingActiveIndicator(): boolean {
        if ((process.env.TEST_RECORDING_ACTIVE &&
            (process.env.TEST_RECORDING_ACTIVE === "0" || process.env.TEST_RECORDING_ACTIVE === "false" || process.env.TEST_RECORDING_ACTIVE === "inactive")) ||
            !process.env.TEST_RECORDING_ACTIVE) {
            return false;
        } else {
            return true;
        }
    }
}