From 7f982a1908d652eae7fbfcd745ebbed434bf11af Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Mon, 5 Oct 2020 16:43:57 +0530 Subject: [PATCH] Changes env file --- .env | 1 + scripts/register-domains.js | 4 ++-- utils/constants.js | 9 +++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.env b/.env index 4dd9ee6b6..f87d42da0 100644 --- a/.env +++ b/.env @@ -1,3 +1,4 @@ NC_USER=xxx NC_API_KEY=xxxxxxxxxxxxxxx NC_DOMAIN=domain.com +IP_ADDRESS=100.100.100.100 diff --git a/scripts/register-domains.js b/scripts/register-domains.js index 6fe38e351..ef053ef60 100644 --- a/scripts/register-domains.js +++ b/scripts/register-domains.js @@ -1,5 +1,5 @@ const R = require('ramda'); -const { VALID_RECORD_TYPES, TTL } = require('../utils/constants'); +const { VALID_RECORD_TYPES, TTL, ENV } = require('../utils/constants'); const { domainService: dc } = require('../utils/domain-service'); const { getDomains: gd } = require('../utils/domain'); @@ -28,7 +28,7 @@ const registerDomains = async ({ domainService, getDomains }) => { }; const main = async () => { - console.log('Registering domains...'); + console.log(`Registering domains in ${ENV}...`); const result = await registerDomains({ domainService: dc, getDomains: gd }); console.log(result); }; diff --git a/utils/constants.js b/utils/constants.js index 18ff9dd24..0dc7aa634 100644 --- a/utils/constants.js +++ b/utils/constants.js @@ -1,14 +1,15 @@ const path = require('path'); -require('dotenv').config({ path: path.resolve('.env.sandbox') }); +const { ENV = 'sandbox' } = process.env; +require('dotenv').config({ path: path.resolve(`.env.${ENV}`) }); -const { NC_USER, NC_API_KEY, NC_DOMAIN } = process.env; +const { NC_USER, NC_API_KEY, NC_DOMAIN, IP_ADDRESS } = process.env; module.exports = { VALID_RECORD_TYPES: ['CNAME', 'A', 'ALIAS', 'URL'], NC_DOMAIN: NC_DOMAIN || 'booboo.xyz', NC_USER: NC_USER || 'test', NC_API_KEY: NC_API_KEY || 'fake_key', - ENV: 'sandbox', + ENV, TTL: 5*60, - IP_ADDRESS: '100.100.100.100', + IP_ADDRESS, };