forked from kobotoolbox/enketo-express
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated: configuration mechanism now overrides default
- Loading branch information
Showing
17 changed files
with
60 additions
and
52 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
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 |
---|---|---|
@@ -1,20 +1,42 @@ | ||
"use strict"; | ||
|
||
var config = require( '../../config/config' ), | ||
var config = require( '../../config/default-config' ), | ||
localConfig = require( '../../config/config' ), | ||
merge = require( 'lodash/object/merge' ), | ||
path = require( 'path' ), | ||
fs = require( 'fs' ), | ||
themePath = path.join( __dirname, '../../public/css' ), | ||
languagePath = path.join( __dirname, '../../locales' ), | ||
debug = require( 'debug' )( 'config-model' ); | ||
|
||
module.exports = { | ||
client: function() { | ||
var app = require( '../../config/express' ); | ||
// merge default and local config | ||
merge( config, localConfig ); | ||
|
||
// detect supported themes | ||
config[ 'themes supported' ] = []; | ||
if ( fs.existsSync( themePath ) ) { | ||
fs.readdirSync( themePath ).forEach( function( file ) { | ||
var matches = file.match( /^theme-([A-z]+)\.css$/ ); | ||
if ( matches && matches.length > 1 ) { | ||
config[ 'themes supported' ].push( matches[ 1 ] ); | ||
} | ||
} ); | ||
} | ||
|
||
return { | ||
googleApiKey: config.google[ 'api key' ], | ||
maps: config.maps, | ||
widgets: config.widgets, | ||
modernBrowsersURL: 'modern-browsers', | ||
supportEmail: config.support.email, | ||
themesSupported: app.get( 'themes supported' ), | ||
languagesSupported: app.get( 'languages supported' ) | ||
}; | ||
// detect supported languages | ||
config[ 'languages supported' ] = fs.readdirSync( languagePath ).filter( function( file ) { | ||
return fs.statSync( path.join( languagePath, file ) ).isDirectory(); | ||
} ); | ||
|
||
module.exports = { | ||
server: config, | ||
client: { | ||
googleApiKey: config.google[ 'api key' ], | ||
maps: config.maps, | ||
widgets: config.widgets, | ||
modernBrowsersURL: 'modern-browsers', | ||
supportEmail: config.support.email, | ||
themesSupported: config[ 'themes supported' ], | ||
languagesSupported: config[ 'languages supported' ] | ||
} | ||
}; |
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
File renamed without changes.
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
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
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