Add support for environment variables

pull/1331/head
Kamran Ahmed 5 years ago
parent bcad685e27
commit 9d2fdfa7cf
  1. 3
      components/page-footer/index.js
  2. 1
      components/site-nav/index.js
  3. 3
      config/dev.json
  4. 16
      next.config.js

@ -29,8 +29,7 @@ const PageFooter = () => (
<li className='foot-header'>Contribute</li>
<li><a href={ siteConfig.url.addGuide } target="_blank">Write a Guide</a></li>
<li><a href={ siteConfig.url.addRoadmap } target="_blank">Submit a Roadmap</a></li>
<li><a href={ siteConfig.url.addResources } target="_blank">Add resources</a></li>
<li><a href={ siteConfig.url.repo } target="_blank">Codebase</a></li>
<li><a href='/about'>About this Site</a></li>
</ul>
</div>
<div className="site-learn foot-col col-12 col-sm-4 col-lg-2">

@ -11,7 +11,6 @@ const SiteNav = () => (
<div className='nav-links'>
<a href='/roadmaps'>Roadmaps</a>
<a href='/guides'>Guides</a>
<a href='/about' className='d-none d-md-inline-block'>FAQ</a>
<a href='/signup' className='d-none d-md-inline-block'>Subscribe</a>
</div>

@ -1,3 +0,0 @@
{
"GA_SECRET": ""
}

@ -20,14 +20,20 @@ const { getPathMap } = require("./scripts/path-map");
const loadConfig = (env = 'dev') => {
const configPath = `./config/${env}.json`;
if (!fs.existsSync(configPath)) {
console.log(`Config file not found: ${configPath}`);
process.exit(1);
console.warn(`Config file not found: ${configPath}. Using environment variables only.`);
}
console.log(`Config file found: ${configPath}`);
const appConfig = {};
// @todo stringify the values for webpack - it doesn't understand objects
return require(configPath);
for (let key in process.env) {
if (!key.startsWith('ROADMAP_')) {
continue;
}
appConfig[key.replace('ROADMAP_', '')] = process.env[key];
}
return appConfig;
};
const options = {

Loading…
Cancel
Save