-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
π§βπ»(frontend) split settings file
All settings may be changeable in development without interfering with production settings.
- Loading branch information
1 parent
cec322c
commit d1aefca
Showing
7 changed files
with
83 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { mergeWith } from 'lodash-es'; | ||
import * as prodSettings from './settings.prod'; | ||
import * as testSettings from './settings.test'; | ||
|
||
let settingsOverride = {}; | ||
if (process.env.NODE_ENV === 'development') { | ||
try { | ||
settingsOverride = require('./settings.local.ts'); | ||
} catch { | ||
// no local settings found, do nothing | ||
} | ||
} else if (process.env.NODE_ENV === 'test') { | ||
settingsOverride = testSettings; | ||
} | ||
|
||
try { | ||
settingsOverride = require('./settings.local.ts'); | ||
} catch { | ||
// no local settings found, do nothing | ||
} | ||
|
||
const settings = mergeWith({}, prodSettings, settingsOverride); | ||
|
||
export const { | ||
API_LIST_DEFAULT_PARAMS, | ||
EDX_CSRF_TOKEN_COOKIE_NAME, | ||
RICHIE_USER_TOKEN, | ||
RICHIE_LTI_ANONYMOUS_USER_ID_CACHE_KEY, | ||
JOANIE_API_VERSION, | ||
REACT_QUERY_SETTINGS, | ||
PAYMENT_SETTINGS, | ||
CONTRACT_SETTINGS, | ||
CONTRACT_DOWNLOAD_SETTINGS, | ||
PER_PAGE, | ||
MOCK_SERVICE_WORKER_ENABLED, | ||
DEBUG_UNION_RESOURCES_HOOK, | ||
CURRENT_JOANIE_DEV_DEMO_USER, | ||
} = settings; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// This configuration file can be overridden with settings.dev.ts file. | ||
// `$ cp settings.local.dist.ts settings.local.ts`, then change what's needed | ||
// in local environment in settings.local.ts. | ||
import { DevDemoUser } from 'api/lms/dummy'; | ||
|
||
// disable react query cache | ||
// export const REACT_QUERY_SETTINGS = { | ||
// staleTimes: { | ||
// session: 0, | ||
// sessionItems: 0, | ||
// }, | ||
// }; | ||
|
||
/** | ||
* Available users: | ||
* * admin | ||
* * user0 | ||
* * user1 | ||
* * user2 | ||
* * user3 | ||
* * user4 | ||
* * organization_owner | ||
* * student_user | ||
*/ | ||
export const CURRENT_JOANIE_DEV_DEMO_USER: DevDemoUser = 'admin'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// This confiuration file is used for testing. | ||
// Mostly usefull to test our test tools. | ||
import { DevDemoUser } from 'api/lms/dummy'; | ||
|
||
/** | ||
* Available users: | ||
* * admin | ||
* * user0 | ||
* * user1 | ||
* * user2 | ||
* * user3 | ||
* * user4 | ||
* * organization_owner | ||
* * student_user | ||
*/ | ||
export const CURRENT_JOANIE_DEV_DEMO_USER: DevDemoUser = 'admin'; |