Skip to content

Commit

Permalink
feat(util): validate required environment variables are set
Browse files Browse the repository at this point in the history
  • Loading branch information
remarkablemark committed Dec 29, 2019
1 parent d4c0934 commit b82e070
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions util/validate-environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,20 @@ const validateEnvironment = () => {
} else {
console.log(`Node version: ${process.version}`);
}

if (!process.env.USERNAME) {
console.log('Error: Missing environment variable `USERNAME`');
process.exit();
} else {
console.log(`USERNAME: ${process.env.USERNAME}`);
}

if (!process.env.PASSWORD) {
console.error('Error: Missing environment variable `PASSWORD`');
process.exit();
} else {
console.log(`PASSWORD: ${'*'.repeat(process.env.PASSWORD.length)}`);
}
};

module.exports = validateEnvironment;

0 comments on commit b82e070

Please sign in to comment.