Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit edc92e4

Browse files
committed
Cleaner env variable handling and single example entry point
1 parent 20f255a commit edc92e4

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

webpack.config.coffee

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,27 +37,39 @@ module.exports = (options) ->
3737
process.env.ENV = ENV
3838

3939
# Set environment variables to be injected into the app by envify
40+
envConstants =
41+
AUTH0_TOKEN_NAME : 'userJWTToken'
42+
AUTH0_REFRESH_TOKEN_NAME : 'userRefreshJWTToken'
43+
44+
if ENV == 'MOCK'
45+
Object.assign envConstants,
46+
API_URL : 'https://api.topcoder.com'
47+
4048
if ENV == 'DEV'
41-
envConstants =
49+
Object.assign envConstants,
4250
API_URL : 'https://api-work.topcoder-dev.com'
4351
AUTH0_CLIENT_ID : 'JFDo7HMkf0q2CkVFHojy3zHWafziprhT'
4452
AUTH0_DOMAIN : 'topcoder-dev.auth0.com'
4553
NEWRELIC_APPLICATION_ID : '7374849'
4654
NEWRELIC_LICENSE_KEY : '496af5ee90'
4755

4856
if ENV == 'QA'
49-
envConstants =
57+
Object.assign envConstants,
5058
API_URL : 'https://api-work.topcoder-qa.com'
5159
AUTH0_CLIENT_ID : 'EVOgWZlCtIFlbehkq02treuRRoJk12UR'
5260
AUTH0_DOMAIN : 'topcoder-qa.auth0.com'
5361

5462
if ENV == 'PROD'
55-
envConstants =
63+
Object.assign envConstants,
5664
API_URL : 'https://api-work.topcoder.com'
5765
AUTH0_CLIENT_ID : '6ZwZEUo2ZK4c50aLPpgupeg5v2Ffxp9P'
5866
AUTH0_DOMAIN : 'topcoder.auth0.com'
5967

60-
Object.assign process.env, envConstants if envConstants
68+
console.log 'assigning constants to process.env:'
69+
console.log envConstants
70+
console.log '\n\n'
71+
72+
Object.assign process.env, envConstants
6173

6274
# Config
6375
# Reference: http://webpack.github.io/docs/configuration.html
@@ -75,14 +87,7 @@ module.exports = (options) ->
7587
if entry
7688
config.entry = entry
7789
else
78-
srcPath = path.join dirname, '/src/src.coffee'
79-
examplePath = path.join dirname, '/example/example.coffee'
80-
config.entry =
81-
src : srcPath
82-
example: [
83-
"webpack-dev-server/client?http://localhost:#{usePort}"
84-
examplePath
85-
]
90+
config.entry = path.join dirname, '/example/example.coffee'
8691

8792
# Output
8893
# Reference: http://webpack.github.io/docs/configuration.html#output

0 commit comments

Comments
 (0)