forked from DSpace/dspace-angular
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a mechanism to configure environment variables.
- Loading branch information
Showing
7 changed files
with
134 additions
and
34 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 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,3 @@ | ||
{ | ||
"title": "" | ||
} |
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,26 @@ | ||
{ | ||
"production": false, | ||
// Location of REST API | ||
"rest": { | ||
// By default, we are currently using a local proxy running on port 5050. | ||
// This is necessary because our actual REST API doesn't provide CORS headers yet! | ||
// The actual REST API path is in the 'proxy' settings below. | ||
// NOTE: Space is capitalized because 'namespace' is a reserved string in TypeScript | ||
"nameSpace": "", | ||
"baseURL": "" | ||
}, | ||
// REST Location that we are proxying (see src/proxy.ts) | ||
// (Since we are using a proxy at this time, the actual REST API goes here) | ||
"proxy": { | ||
"nameSpace": "", | ||
"baseURL": "" | ||
// E.g. to use demo.dspace.org REST API, use the below values *instead* | ||
//nameSpace: '/rest', | ||
//baseURL: 'https://demo.dspace.org' | ||
}, | ||
// Path and Port in use for this Angular2 UI | ||
"ui": { | ||
"nameSpace": "", | ||
"baseURL": "" | ||
} | ||
} |
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 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,34 @@ | ||
// Look in ./config folder for config | ||
|
||
const path = require('path'); | ||
|
||
let configContext = require.context("../config", false, /json$/); | ||
let EnvConfig : any = {}; | ||
let EnvConfigFile : string; | ||
let CommonConfig : any = {}; | ||
|
||
try { | ||
CommonConfig = configContext('./environment.common.json'); | ||
} catch (e) { | ||
throw new Error(`Cannot find file "${path.resolve('config', './environment.common.json')}"`); | ||
} | ||
|
||
switch (process.env.NODE_ENV) { | ||
case 'prod': | ||
case 'production': | ||
EnvConfigFile = './environment.prod.json'; | ||
break; | ||
case 'dev': | ||
case 'development': | ||
default: | ||
EnvConfigFile = './environment.dev.json'; | ||
} | ||
try { | ||
EnvConfig = configContext(EnvConfigFile); | ||
} catch (e) { | ||
throw new Error(`Cannot find file "${path.resolve('config', EnvConfigFile)}"`); | ||
} | ||
|
||
const GlobalConfig = Object.assign(CommonConfig, EnvConfig); | ||
|
||
export {GlobalConfig} |