static value()

in src/config.js [14:49]


    static value (name) {

        if (!(name in this.CONFIG)) {
            console.log(`Configuration: There is no key named "${name}"`)
            return
        }

        const value = this.CONFIG[name]


        if (!value) {
            console.log(`Configuration: Value for "${name}" is not defined`)
            return
        }

        if (value.startsWith('$VUE_APP_')) {
            // value was not replaced, it seems we are in development.
            // Remove $ and get current value from process.env
            const envName = value.substr(1)



            const envValue = process.env[envName]
            if (envValue) {
                return envValue
            } else if (window.serverConfig && window.serverConfig[envName]) {
                // Check if the variables is set by the portal server
                return window.serverConfig[envName];
            } else {
                console.log(`Configuration: Environment variable "${envName}" is not defined`)
            }
        } else {
            // value was already replaced, it seems we are in production.
            return value
        }
    }