All files / classes/Configuration index.ts

77.78% Statements 7/9
50% Branches 2/4
100% Functions 1/1
77.78% Lines 7/9

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  1x 1x   1x         1x         1x 1x         1x      
import { Config } from "./config";
import ProductionConfig from "./ProductionConfig";
import TestConfig from "./TestConfig";
 
export default class Configuration {
  private static _config: Config;
 
  public static get config(): Config {
    // return singleton instance
    Iif (typeof Configuration._config !== "undefined") {
      return Configuration._config;
    }
 
    // create config
    Eif (process.env.NODE_ENV === "test") {
      Configuration._config = new TestConfig();
    } else {
      Configuration._config = new ProductionConfig();
    }
 
    return Configuration._config;
  }
}