Skip to content
Snippets Groups Projects
Select Git revision
  • 7b6ab542dbf1c48c7766b73adc21544f5776aefa
  • main default protected
  • jw_sonar
  • v6.0.0 protected
  • interactive-mode-preference
  • bedran_exercise-list
  • add_route_user
  • Jw_sonar_backup
  • exercise_list_filter
  • assignment_filter
  • add_route_assignments
  • move-to-esm-only
  • 6.0.0-dev
  • Pre-alpha
  • 5.0.0
  • Latest
  • 4.2.0
  • 4.1.1
  • 4.1.0
  • 4.0.1
  • 4.0.0
  • 3.5.0
  • 3.4.2
  • 3.4.1
  • 3.3.0
  • 3.2.3
  • 3.2.2
  • 3.2.0
  • 3.1.2
  • 3.1.1
  • 3.1.0
  • 3.0.1
32 results

Config.ts

Blame
  • Config.ts 905 B
    import * as os     from 'os';
    import HttpManager from '../managers/HttpManager';
    
    
    class Config {
        private static _instance: Config;
    
        private _apiURL!: string;
    
        public readonly localConfig: {
            folder: string; file: string;
        };
    
        private constructor() {
            this.apiURL = process.env.API_URL || '';
    
            this.localConfig = {
                folder: (process.env.LOCAL_CONFIG_FOLDER || '').replace('~', os.homedir()),
                file  : process.env.LOCAL_CONFIG_FILE || ''
            };
        }
    
        get apiURL(): string {
            return this._apiURL;
        }
    
        set apiURL(url: string) {
            this._apiURL = url;
    
            HttpManager.API_BASE_URL = this._apiURL;
        }
    
        public static get instance(): Config {
            if ( !Config._instance ) {
                Config._instance = new Config();
            }
    
            return Config._instance;
        }
    }
    
    
    export default Config.instance;