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

Commit

Permalink
on by default
Browse files Browse the repository at this point in the history
  • Loading branch information
wheresrhys committed May 26, 2015
1 parent 12ed495 commit 1585991
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
9 changes: 7 additions & 2 deletions bin/next-build-tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,14 @@ program
.command('configure [source] [target]')
.description('downloads environment variables from next-config-vars and uploads them to the current app')
.option('-o, --overrides <abc>', 'override these values', list)
.option('-d, --drain-to-splunk', 'configure to drain logs to splunk')
.option('-n, --no-splunk', 'configure not to drain logs to splunk')
.action(function(source, target, options) {
configure({ source: source, target: target, overrides: options.overrides }).catch(exit);
configure({
source: source,
target: target,
overrides: options.overrides,
splunk: !options.noSplunk
}).catch(exit);
});

program
Expand Down
10 changes: 5 additions & 5 deletions tasks/configure.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,20 +83,20 @@ module.exports = function(opts) {
.then(function() {
console.log(target + " config vars are set");
}).then(function () {
if (opts.drainToSplunk) {
if (opts.splunk) {
if (!process.env.SPLUNK_URL) {
throw 'Either set a SPLUNK_URL environment variable or run `nbt configure --no-splunk`';
}
console.log("Setting up logging to splunk");
return fetch('https://api.heroku.com/apps/' + target + '/log-drains', {
headers: authorizedPostHeaders,
method: 'post',
body: JSON.stringify({
url: process.env.SPLUNK_URL + normalizeName(packageJson.name)
url: process.env.SPLUNK_URL + target
})
})
.then(function () {
console.log(target + " logging to splunk");
})
.catch(function () {
console.log(target + " failed to set up logging to splunk");
});
}
});
Expand Down

0 comments on commit 1585991

Please sign in to comment.