Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

:zap: dotenv

Liyas Thomasd4aa3699f2c2
diff --git a/.env.example b/.env.example
new file mode 100644
index 000000000..ead263bd8
--- /dev/null
+++ b/.env.example
@@ -0,0 +1,15 @@
+# Google Analytics
+GA_ID=UA-XXXXXXXX-X
+
+# Google Tag Manager
+GTM_ID=GTM-XXXXXXX
+
+# Firebase
+API_KEY=api-key
+AUTH_DOMAIN=project-id.firebaseapp.com
+DATABASE_URL=https://project-id.firebaseio.com
+PROJECT_ID=project-id
+STORAGE_BUCKET=project-id.appspot.com
+MESSAGING_SENDER_ID=sender-id
+APP_ID=app-id
+MEASUREMENT_ID=G-measurement-id
diff --git a/functions/fb.js b/functions/fb.js
index 77d50bc29..2a6bc3a3e 100644
--- a/functions/fb.js
+++ b/functions/fb.js
@@ -4,14 +4,14 @@ import "firebase/auth"
// Initialize Firebase, copied from cloud console
const firebaseConfig = {
- apiKey: "AIzaSyCMsFreESs58-hRxTtiqQrIcimh4i1wbsM",
- authDomain: "postwoman-api.firebaseapp.com",
- databaseURL: "https://postwoman-api.firebaseio.com",
- projectId: "postwoman-api",
- storageBucket: "postwoman-api.appspot.com",
- messagingSenderId: "421993993223",
- appId: "1:421993993223:web:ec0baa8ee8c02ffa1fc6a2",
- measurementId: "G-ERJ6025CEB",
+ apiKey: process.env.API_KEY,
+ authDomain: process.env.AUTH_DOMAIN,
+ databaseURL: process.env.DATABASE_URL,
+ projectId: process.env.PROJECT_ID,
+ storageBucket: process.env.STORAGE_BUCKET,
+ messagingSenderId: process.env.MESSAGING_SENDER_ID,
+ appId: process.env.APP_ID,
+ measurementId: process.env.MEASUREMENT_ID,
}
firebase.initializeApp(firebaseConfig)
diff --git a/nuxt.config.js b/nuxt.config.js
index f6b259da5..1f36720df 100644
--- a/nuxt.config.js
+++ b/nuxt.config.js
@@ -1,3 +1,4 @@
+require("dotenv").config()
// Some helpful application constants.
// TODO: Use these when rendering the pages (rather than just for head/meta tags...)
export const options = {
@@ -147,19 +148,18 @@ export default {
/*
** Nuxt.js dev-modules
*/
- buildModules: ["@nuxtjs/gtm"],
+ buildModules: ["@nuxtjs/gtm", "@nuxtjs/dotenv", "@nuxtjs/google-analytics"],
/*
** Nuxt.js modules
*/
modules: [
// See https://goo.gl/OOhYW5
- ["@nuxtjs/pwa"],
- ["@nuxtjs/axios"],
- ["@nuxtjs/toast"],
- ["@nuxtjs/google-analytics"],
- ["@nuxtjs/sitemap"],
- ["@nuxtjs/robots"],
- ["nuxt-i18n"],
+ "@nuxtjs/pwa",
+ "@nuxtjs/axios",
+ "@nuxtjs/toast",
+ "@nuxtjs/sitemap",
+ "@nuxtjs/robots",
+ "nuxt-i18n",
],
pwa: {
manifest: {
@@ -188,10 +188,10 @@ export default {
keepOnHover: true,
},
googleAnalytics: {
- id: process.env.GA_ID || "UA-61422507-2",
+ id: process.env.GA_ID,
},
gtm: {
- id: process.env.GTM_ID || "GTM-MXWD8NQ",
+ id: process.env.GTM_ID,
},
sitemap: {
hostname: "https://postwoman.io",
diff --git a/package-lock.json b/package-lock.json
index e1b4dd04a..c43858aeb 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -2198,6 +2198,16 @@
}
}
},
+ "@nuxtjs/dotenv": {
+ "version": "1.4.1",
+ "resolved": "https://registry.npmjs.org/@nuxtjs/dotenv/-/dotenv-1.4.1.tgz",
+ "integrity": "sha512-DpdObsvRwC8d89I9mzz6pBg6e/PEXHazDM57DOI1mmML2ZjHfQ/DvkjlSzUL7T+TnW3b/a4Ks5wQx08DqFBmeQ==",
+ "dev": true,
+ "requires": {
+ "consola": "^2.10.1",
+ "dotenv": "^8.1.0"
+ }
+ },
"@nuxtjs/google-analytics": {
"version": "2.2.3",
"resolved": "https://registry.npmjs.org/@nuxtjs/google-analytics/-/google-analytics-2.2.3.tgz",
@@ -5239,6 +5249,12 @@
}
}
},
+ "dotenv": {
+ "version": "8.2.0",
+ "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.2.0.tgz",
+ "integrity": "sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw==",
+ "dev": true
+ },
"duplexer": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz",
diff --git a/package.json b/package.json
index 970e5350c..8c13cab04 100644
--- a/package.json
+++ b/package.json
@@ -53,6 +53,7 @@
"yargs-parser": "^18.1.3"
},
"devDependencies": {
+ "@nuxtjs/dotenv": "^1.4.1",
"@nuxtjs/google-analytics": "^2.2.3",
"cypress": "^4.5.0",
"eslint": "^6.8.0",