require('dotenv').config();

module.exports = {
    host: {
        dev: 'dev.foo.redhat.com',
        qa: 'qa.foo.redhat.com',
        stage: 'stage.foo.redhat.com',
        prod: 'prod.foo.redhat.com',
    },
    port: 1337,
    startPath: process.env.PUBLIC_PATH,
    verbose: true,
    portalChrome: {
        resolveSPAComments: true
    },
    bs: {
        // Enable https and fix sso server in QA (the last bit may not be necessary any longer)
        https: true,
        rewriteRules: [
            {
                match: 'sso.dev2.redhat.com',
                replace: 'sso.qa.redhat.com',
            },
        ],
    },
    routes: {
        // Route /solution-engine requests to the webpack dev server
        [process.env.PUBLIC_PATH]: {
            host: {
                dev: `https://${process.env.HOST}:${process.env.PORT}`,
                qa: `https://${process.env.HOST}:${process.env.PORT}`,
                stage: `https://${process.env.HOST}:${process.env.PORT}`,
                prod: `https://${process.env.HOST}:${process.env.PORT}`,
            }
        },

        [process.env.SOCKJS]: {
            host: {
                dev: `https://${process.env.HOST}:${process.env.PORT}`,
                qa: `https://${process.env.HOST}:${process.env.PORT}`,
                stage: `https://${process.env.HOST}:${process.env.PORT}`,
                prod: `https://${process.env.HOST}:${process.env.PORT}`,
            }
        },

        // Route all other requests to the Portal
        '/': {
            host: {
                dev: 'https://access.devgssci.devlab.phx1.redhat.com',
                qa: 'https://access.qa.redhat.com',
                stage: 'https://access.stage.redhat.com',
                prod: 'https://access.redhat.com',
            }
        },
    },
};
