Skip to content
Snippets Groups Projects
Select Git revision
  • 706ea01362de3ba126039580c2109225a8d1a084
  • main default protected
  • v3.3.0
  • add_link_in_readme
  • v3.2.1
  • v3.2.0
  • v3.1.2
  • 3.3.0-dev
  • 3.2.0
  • 3.1.2
  • 3.1.1
  • 3.1.0
  • 3.0.1
  • 3.0.0
  • 2.2.0
  • 2.1.0
  • 2.0.0
  • v1.0.1
18 results

Config.ts

Blame
  • Config.ts 1.80 KiB
    import getAppDataPath from 'appdata-path';
    
    
    class Config {
        public readonly localConfig: {
            folder: string; sessionFile: string; stateFile: string;
        };
    
        public readonly versionUpdateInformationPeriodHours: number;
    
        public readonly gitlab: {
            cliReleasePage: string
        };
    
        public readonly login: {
            server: {
                port: number, route: string
            }, gitlab: {
                url: {
                    code: string
                }
            }
        };
    
        public readonly folders: {
            defaultLocalExercise: string
        };
    
        public readonly exercise: {
            neededFiles: Array<string>
        };
    
        public interactiveMode: boolean;
    
        constructor() {
            this.localConfig = {
                folder     : getAppDataPath('DojoCLI'),
                sessionFile: process.env.LOCAL_CONFIG_FILE_SESSION || '',
                stateFile  : process.env.LOCAL_CONFIG_STATE || ''
            };
    
            this.versionUpdateInformationPeriodHours = Number(process.env.VERSION_UPDATE_INFORMATION_PERIOD_HOURS || 24);
    
            this.gitlab = {
                cliReleasePage: process.env.GITLAB_CLI_RELEASE_PAGE || ''
            };
    
            this.login = {
                server: {
                    port : Number(process.env.LOGIN_SERVER_PORT || 30992),
                    route: process.env.LOGIN_SERVER_ROUTE || ''
                },
                gitlab: {
                    url: {
                        code: process.env.LOGIN_GITLAB_URL_CODE || ''
                    }
                }
            };
    
            this.folders = {
                defaultLocalExercise: process.env.LOCAL_EXERCISE_DEFAULT_FOLDER || './'
            };
    
            this.exercise = {
                neededFiles: JSON.parse(process.env.EXERCISE_NEEDED_FILES || '[]')
            };
    
            this.interactiveMode = process.env.INTERACTIVE_MODE === 'true';
        }
    }
    
    
    export default new Config();