Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: new approach to multi domain #833

Merged
merged 27 commits into from
Mar 8, 2024
Merged

Conversation

TurtIeSocks
Copy link
Collaborator

@TurtIeSocks TurtIeSocks commented Aug 30, 2023

A new, and much better approach to multi domain management

  • Makes use of the NODE_CONFIG_ENV env variable to determine which local.json files to load
  • Loads default.json => local.json => local-{NODE_CONFIG_ENV}.json
  • You set all of your base defaults in local.json still, then set things that are unique to those domains, such geoJsonFilename or authentication strategies in each of the domain specifics jsons
  • For now this is opt in, but when 2.0 is released, this will be the only option. multiDomains array in the config will be removed!
  • The NODE_CONFIG_ENV var names should not contain / or .
  • Gives access to customize the entire config per domain, not just the map object
  • Docker is less elegant... example coming soon.
  • More info to come

SEE README

File System

// config folder
local.json
local-map_2.json
local-map_3.json

New PM2 ecosystem.config.js Example

module.exports = {
  apps: [
    {
      name: 'ReactMap',
      script: 'ReactMap.js',
      instances: 1,
      autorestart: true,
      exec_mode: 'fork',
      max_memory_restart: '2G',
    },
    {
      name: 'ReactMap_2',
      script: 'ReactMap.js',
      instances: 1,
      autorestart: true,
      exec_mode: 'fork',
      max_memory_restart: '2G',
      env: {
        NODE_CONFIG_ENV: 'map_2',
      },
    },
    {
      name: 'ReactMap_3',
      script: 'ReactMap.js',
      instances: 1,
      autorestart: true,
      exec_mode: 'fork',
      max_memory_restart: '2G',
      env: {
        NODE_CONFIG_ENV: 'map_3',
      },
    },
  ],
}

@TurtIeSocks TurtIeSocks marked this pull request as ready for review February 23, 2024 23:18
@TurtIeSocks TurtIeSocks merged commit 15a878e into develop Mar 8, 2024
2 checks passed
@TurtIeSocks TurtIeSocks deleted the better-multi-domain branch March 8, 2024 14:44
Copy link

github-actions bot commented Mar 8, 2024

🎉 This PR is included in version 1.30.0-develop.20 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant