Skip to content

Commit

Permalink
#354 Add MAIN_MISSION ENV (#355)
Browse files Browse the repository at this point in the history
  • Loading branch information
tariqksoliman authored Mar 29, 2023
1 parent a66c7af commit 0b47af1
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 9 deletions.
1 change: 1 addition & 0 deletions configuration/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ function getClientEnvironment(publicUrl) {
}),
PORT: process.env.PORT,
ENABLE_MMGIS_WEBSOCKETS: process.env.ENABLE_MMGIS_WEBSOCKETS,
MAIN_MISSION: process.env.MAIN_MISSION,
}
);
// Stringify all values so we can feed into webpack DefinePlugin
Expand Down
19 changes: 11 additions & 8 deletions docker-compose-env.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '3'
version: "3"
services:
mmgis:
image: mmgis:development
Expand All @@ -23,13 +23,16 @@ services:
- FRAME_SRC=
- LEADS=["ADMIN"]
- ENABLE_MMGIS_WEBSOCKETS=true
- ENABLE_CONFIG_WEBSOCKETS=true
- ENABLE_CONFIG_OVERRIDE=false
- MAIN_MISSION=
volumes:
- /var/www/html/Missions/:/usr/src/app/Missions
mmgis.db:
image: postgis/postgis:10-2.5-alpine
env_file: .env
ports:
- 5432:5432
restart: on-failure
volumes:
- mmgis-db:/var/lib/postgresql/data
image: postgis/postgis:10-2.5-alpine
env_file: .env
ports:
- 5432:5432
restart: on-failure
volumes:
- mmgis-db:/var/lib/postgresql/data
4 changes: 4 additions & 0 deletions docs/pages/Setup/ENVs/ENVs.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,7 @@ If true, notifications are sent to /configure users whenever the current mission
#### `ENABLE_CONFIG_OVERRIDE=`

For use when `ENABLE_CONFIG_WEBSOCKETS=true` (if `ENABLE_CONFIG_WEBSOCKETS=false`, all saves will freely overwrite already). If true, gives /configure users the ability to override changes made to the configuration while they were working on it with their own. | boolean | default `false`

#### `MAIN_MISSION=`

If the new MAIN_MISSION ENV is set to a valid mission, skip the landing page and go straight to that mission. Other missions will still be accessible by either forcing the landing page (clicking the top-left M logo) or by going to a link directly. | string | default `''`
4 changes: 3 additions & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@
mmgisglobal.PORT = "#{PORT}";
mmgisglobal.ROOT_PATH = "#{ROOT_PATH}";
mmgisglobal.ENABLE_MMGIS_WEBSOCKETS = "#{ENABLE_MMGIS_WEBSOCKETS}";
mmgisglobal.MAIN_MISSION = "#{MAIN_MISSION};"
mmgisglobal.THIRD_PARTY_COOKIES = "#{THIRD_PARTY_COOKIES}";
break;
default:
Expand All @@ -351,7 +352,8 @@
mmgisglobal.PORT = "%PORT%";
mmgisglobal.ROOT_PATH = "%ROOT_PATH%";
mmgisglobal.ENABLE_MMGIS_WEBSOCKETS = "%ENABLE_MMGIS_WEBSOCKETS%";
mmgisglobal.THIRD_PARTY_COOKIES = "#{THIRD_PARTY_COOKIES}";
mmgisglobal.MAIN_MISSION = "%MAIN_MISSION%";
mmgisglobal.THIRD_PARTY_COOKIES = "%THIRD_PARTY_COOKIES%";
// eslint-disable-next-line
mmgisglobal.HOSTS = %HOSTS%;
break;
Expand Down
1 change: 1 addition & 0 deletions run/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,7 @@ setups.getBackendSetups(function (setups) {
FORCE_CONFIG_PATH: process.env.FORCE_CONFIG_PATH,
CLEARANCE_NUMBER: process.env.CLEARANCE_NUMBER,
ENABLE_MMGIS_WEBSOCKETS: process.env.ENABLE_MMGIS_WEBSOCKETS,
MAIN_MISSION: process.env.MAIN_MISSION,
THIRD_PARTY_COOKIES: process.env.THIRD_PARTY_COOKIES,
PORT: process.env.PORT,
ROOT_PATH: ROOT_PATH,
Expand Down
4 changes: 4 additions & 0 deletions sample.env
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,7 @@ ENABLE_MMGIS_WEBSOCKETS=false
ENABLE_CONFIG_WEBSOCKETS=false
# For use when ENABLE_CONFIG_WEBSOCKETS=true (if ENABLE_CONFIG_WEBSOCKETS=false, all saves will freely overwrite already). If true, gives /configure users the ability to override changes made to the configuration while they were working on it with their own.
ENABLE_CONFIG_OVERRIDE=false

# If the new MAIN_MISSION ENV is set to a valid mission, skip the landing page and go straight to that mission.
# Other missions will still be accessible by either forcing the landing page (clicking the top-left M logo) or by going to a link directly.
MAIN_MISSION=
10 changes: 10 additions & 0 deletions src/essence/LandingPage/LandingPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ export default {
if (missions.length == 1 && !forceLanding) missionUrl = missions[0]
}

if (
missionUrl == false &&
!forceLanding &&
mmgisglobal.MAIN_MISSION != null &&
typeof mmgisglobal.MAIN_MISSION === 'string' &&
mmgisglobal.MAIN_MISSION.length > 0
) {
missionUrl = mmgisglobal.MAIN_MISSION
}

if (missionUrl == false && !forceConfig) {
var background = d3
.select('body')
Expand Down

0 comments on commit 0b47af1

Please sign in to comment.