Skip to content
This repository has been archived by the owner on Mar 15, 2018. It is now read-only.

Commit

Permalink
v1.2.9 allow easy of switching api settings (bug 1099350)
Browse files Browse the repository at this point in the history
  • Loading branch information
ngokevin committed Nov 26, 2014
1 parent f2af9d0 commit e4c7d0f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
@@ -1 +1,2 @@
*.sw[pon]
node_modules
19 changes: 19 additions & 0 deletions index.js
Expand Up @@ -43,6 +43,25 @@ if (template.indexOf('.html') === -1) {
var PORT = process.env.PORT || config.PORT || 8675;
var LIVERELOAD_PORT = process.env.LIVERELOAD_PORT || PORT + 1000;

// Switch API settings.
if (process.env.API) {
var api = config.serverConfig[process.env.API];

if (!api) {
console.log('Invalid argument for API. Possible options: ');
console.log(Object.keys(config.serverConfig));
process.exit(1);
}

gulp.src(config.JS_DEST_PATH + 'settings_local.js')
.pipe(replace(/api_url: .*/g, "api_url: '" + api.api_url + "',"))

This comment has been minimized.

Copy link
@cvan

cvan Dec 9, 2014

Contributor

should there be a , after .*?

.pipe(replace(/media_url: .*/g, "media_url: '" + api.media_url + "',"))
.pipe(gulp.dest(config.JS_DEST_PATH));

console.log('settings_local.js has been updated to use the specified API:');
console.log(' api_url: ' + api.api_url);
console.log(' media_url: ' + api.media_url);
}

gulp.task('settings_local_js_init', function() {
// Creates a settings_local.js if it doesn't exist.
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,7 +1,7 @@
{
"name": "marketplace-gulp",
"description": "gulpfiles for Firefox Marketplace frontend projects",
"version": "1.2.8",
"version": "1.2.9",
"main": "index",
"repository": {
"url": "git://github.com/mozilla/marketplace-gulp.git",
Expand Down

0 comments on commit e4c7d0f

Please sign in to comment.