Skip to content
Snippets Groups Projects
Select Git revision
  • 8cf6c914d8c64e94a6b78a7e9923ed615d85f9fd
  • master default protected
2 results

dyn_huffman.py

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;