index.js
function _getEnvSpecificConfig () {
  const prodDefaults = {
    env: 'prod',
    url: null,
    debug: false,
    version: 'head',
    language: 'en',
    redisKey: 'CortinaBlock_',
    redisExpire: 600,
    redis: null,
    blocks: {
      title: '1.260060',
      megaMenu: '1.855134',
      secondaryMenu: '1.865038',
      image: '1.77257',
      footer: '1.202278',
      search: '1.77262',
      language: {
        'en_UK': '1.77273',
        'sv_SE': '1.272446'
      },
      analytics: '1.464751',
      gtmAnalytics: '1.714097',
      gtmNoscript: '1.714099'
    }
  }

  const refDefaults = {
    env: 'ref',
    url: null,
    debug: false,
    version: 'head',
    language: 'en',
    redisKey: 'CortinaBlock_',
    redisExpire: 600,
    redis: null,
    blocks: {
      title: '1.260060',
      megaMenu: '1.855134',
      secondaryMenu: '1.865038',
      image: '1.77257',
      footer: '1.202278',
      search: '1.77262',
      language: {
        'en_UK': '1.77273',
        'sv_SE': '1.272446'
      },
      analytics: '1.464751',
      gtmAnalytics: '1.714097',
      gtmNoscript: '1.714099'
    }
  }

  const devDefaults = {
    env: 'dev',
    url: null,
    debug: false,
    version: 'head',
    language: 'en',
    redisKey: 'CortinaBlock_',
    redisExpire: 600,
    redis: null,
    blocks: {
      title: '1.260060',
      megaMenu: '1.260064',
      secondaryMenu: '1.865038',
      image: '1.77257',
      footer: '1.202278',
      search: '1.77262',
      language: {
        'en_UK': '1.77273',
        'sv_SE': '1.272446'
      },
      analytics: '1.464751',
      gtmAnalytics: '1.714097',
      gtmNoscript: '1.714099'
    }
  }

  const host = process.env['SERVER_HOST_URL']
  const hostEnv = _getHostEnv(host)

  const cmhost = process.env['CM_HOST_URL']
  const cmHostEnv = _getHostEnv(cmhost)

  // CM_HOST_URL is used when working with Azure
  if (cmHostEnv) {
    if (cmHostEnv === 'prod') {
      return prodDefaults
    } else if (cmHostEnv === 'ref') {
      return refDefaults
    } else {
      return devDefaults
    }
  }

  if (hostEnv && hostEnv === 'prod') {
    return prodDefaults
  } else if (hostEnv === 'ref') {
    return refDefaults
  } else {
    return devDefaults
  }
}
function _getEnvSpecificConfig () {
  const prodDefaults = {
    env: 'prod',
    url: null,
    debug: false,
    version: 'head',
    language: 'en',
    redisKey: 'CortinaBlock_',
    redisExpire: 600,
    redis: null,
    blocks: {
      title: '1.260060',
      megaMenu: '1.855134',
      secondaryMenu: '1.865038',
      image: '1.77257',
      footer: '1.202278',
      search: '1.77262',
      language: {
        'en_UK': '1.77273',
        'sv_SE': '1.272446'
      },
      analytics: '1.464751',
      gtmAnalytics: '1.714097',
      gtmNoscript: '1.714099'
    }
  }

  const refDefaults = {
    env: 'ref',
    url: null,
    debug: false,
    version: 'head',
    language: 'en',
    redisKey: 'CortinaBlock_',
    redisExpire: 600,
    redis: null,
    blocks: {
      title: '1.260060',
      megaMenu: '1.855134',
      secondaryMenu: '1.865038',
      image: '1.77257',
      footer: '1.202278',
      search: '1.77262',
      language: {
        'en_UK': '1.77273',
        'sv_SE': '1.272446'
      },
      analytics: '1.464751',
      gtmAnalytics: '1.714097',
      gtmNoscript: '1.714099'
    }
  }

  const devDefaults = {
    env: 'dev',
    url: null,
    debug: false,
    version: 'head',
    language: 'en',
    redisKey: 'CortinaBlock_',
    redisExpire: 600,
    redis: null,
    blocks: {
      title: '1.260060',
      megaMenu: '1.260064',
      secondaryMenu: '1.865038',
      image: '1.77257',
      footer: '1.202278',
      search: '1.77262',
      language: {
        'en_UK': '1.77273',
        'sv_SE': '1.272446'
      },
      analytics: '1.464751',
      gtmAnalytics: '1.714097',
      gtmNoscript: '1.714099'
    }
  }

  const host = process.env['SERVER_HOST_URL']
  const hostEnv = _getHostEnv(host)

  const cmhost = process.env['CM_HOST_URL']
  const cmHostEnv = _getHostEnv(cmhost)

  // CM_HOST_URL is used when working with Azure
  if (cmHostEnv) {
    if (cmHostEnv === 'prod') {
      return prodDefaults
    } else if (cmHostEnv === 'ref') {
      return refDefaults
    } else {
      return devDefaults
    }
  }

  if (hostEnv && hostEnv === 'prod') {
    return prodDefaults
  } else if (hostEnv === 'ref') {
    return refDefaults
  } else {
    return devDefaults
  }
}
function _getEnvSpecificConfig ( ) { const prodDefaults = { env : 'prod' , url : null , debug : false , version : 'head' , language : 'en' , redisKey : 'CortinaBlock_' , redisExpire : 600 , redis : null , blocks : { title : '1.260060' , megaMenu : '1.855134' , secondaryMenu : '1.865038' , image : '1.77257' , footer : '1.202278' , search : '1.77262' , language : { 'en_UK' : '1.77273' , 'sv_SE' : '1.272446' } , analytics : '1.464751' , gtmAnalytics : '1.714097' , gtmNoscript : '1.714099' } } const refDefaults = { env : 'ref' , url : null , debug : false , version : 'head' , language : 'en' , redisKey : 'CortinaBlock_' , redisExpire : 600 , redis : null , blocks : { title : '1.260060' , megaMenu : '1.855134' , secondaryMenu : '1.865038' , image : '1.77257' , footer : '1.202278' , search : '1.77262' , language : { 'en_UK' : '1.77273' , 'sv_SE' : '1.272446' } , analytics : '1.464751' , gtmAnalytics : '1.714097' , gtmNoscript : '1.714099' } } const devDefaults = { env : 'dev' , url : null , debug : false , version : 'head' , language : 'en' , redisKey : 'CortinaBlock_' , redisExpire : 600 , redis : null , blocks : { title : '1.260060' , megaMenu : '1.260064' , secondaryMenu : '1.865038' , image : '1.77257' , footer : '1.202278' , search : '1.77262' , language : { 'en_UK' : '1.77273' , 'sv_SE' : '1.272446' } , analytics : '1.464751' , gtmAnalytics : '1.714097' , gtmNoscript : '1.714099' } } const host = process . env [ 'SERVER_HOST_URL' ] const hostEnv = _getHostEnv ( host ) const cmhost = process . env [ 'CM_HOST_URL' ] const cmHostEnv = _getHostEnv ( cmhost ) // CM_HOST_URL is used when working with Azure if ( cmHostEnv ) { if ( cmHostEnv === 'prod' ) { return prodDefaults } else if ( cmHostEnv === 'ref' ) { return refDefaults } else { return devDefaults } } if ( hostEnv && hostEnv === 'prod' ) { return prodDefaults } else if ( hostEnv === 'ref' ) { return refDefaults } else { return devDefaults } }
This function makes a decision based on the HOST_URL environment variable
on whether we are in production, referens or development and serves the correct config.

Most values are the same but could be different based on the current state in choosen Cortina environment.
Eg. if we have imported a database dum from one environment in to the other.
This function makes a decision based on the HOST_URL environment variable on whether we are in production referens or development and serves the correct config .