File tree Expand file tree Collapse file tree 2 files changed +2
-36
lines changed
Expand file tree Collapse file tree 2 files changed +2
-36
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ const fs = require('fs')
99const shortid = require ( 'shortid' )
1010const path = require ( 'path' )
1111const { getRouteDetails, matchRoute } = require ( './routing' )
12- const { reqUtil, pkgJson } = require ( './utils' )
12+ const { reqUtil } = require ( './utils' )
1313require ( 'colors' )
1414
1515/*eslint-disable */
@@ -61,16 +61,11 @@ let _allowedMethods = getAllowedMethods(_config) // Object
6161let _preEvent = ( ) => Promise . resolve ( null )
6262let _postEvent = ( ) => Promise . resolve ( null )
6363
64- // This guarentees that any environment variables defined in the package.json's start scripts get assigned even
65- // if the package.json's start script is not executed (which is the case with FaaS like Google Cloud Functions
66- // or AWS Lambda)
67- pkgJson . initStartVariables ( )
68-
6964//////////////////////// END - INITIALIZE APP ////////////////////////
7065//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
7166//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
7267
73- const getEnvName = ( ) => ( ( _config || { } ) . env || { } ) . active || getProcessEnv ( ) . WEBFUNC_ENV || 'default'
68+ const getEnvName = ( ) => ( ( _config || { } ) . env || { } ) . active || 'default'
7469const getEnv = ( ) => ( ( _config || { } ) . env || { } ) [ getEnvName ( ) ] || { }
7570const getHostingType = ( ) => getEnv ( ) . hostingType || 'localhost'
7671
Original file line number Diff line number Diff line change @@ -95,37 +95,8 @@ const getParams = req => {
9595 } )
9696}
9797
98- const initStartVariables = ( ) => {
99- try {
100- const pkg = require ( cwdPath ( 'package.json' ) ) || { }
101- if ( pkg . scripts && pkg . scripts . start )
102- ( pkg . scripts . start . trim ( ) ) . split ( ' ' )
103- . filter ( x => x )
104- . map ( x => x . split ( '=' ) )
105- . filter ( x => x . length == 2 )
106- . forEach ( x => {
107- /*eslint-disable */
108- if ( x [ 0 ] != 'NODE_ENV' )
109- process . env [ x [ 0 ] ] = x [ 1 ]
110- else
111- process . env . WEBFUNC_ENV = x [ 1 ]
112- /*eslint-enable */
113- } )
114- /*eslint-disable */
115- if ( ! process . env . WEBFUNC_ENV && process . env . NODE_ENV )
116- process . env . WEBFUNC_ENV = process . env . NODE_ENV
117- /*eslint-enable */
118- }
119- catch ( err ) {
120- console . error ( err . message )
121- }
122- }
123-
12498module . exports = {
12599 reqUtil : {
126100 getParams
127- } ,
128- pkgJson : {
129- initStartVariables
130101 }
131102}
You can’t perform that action at this time.
0 commit comments