fix: use .env values - fixed #1639

This commit is contained in:
liyasthomas
2021-05-16 12:23:29 +05:30
parent e104fe3021
commit 02debdc28b
5 changed files with 65 additions and 38 deletions

View File

@@ -1,15 +1,18 @@
# Google Analytics ID # Google Analytics ID
GA_ID=UA-XXXXXXXX-X GA_ID=UA-61422507-4
# Google Tag Manager ID # Google Tag Manager ID
GTM_ID=GTM-XXXXXXX GTM_ID=GTM-NMKVBMV
# Firebase config # Firebase config
API_KEY=api-key API_KEY=AIzaSyCMsFreESs58-hRxTtiqQrIcimh4i1wbsM
AUTH_DOMAIN=project-id.firebaseapp.com AUTH_DOMAIN=postwoman-api.firebaseapp.com
DATABASE_URL=https://project-id.firebaseio.com DATABASE_URL=https://postwoman-api.firebaseio.com
PROJECT_ID=project-id PROJECT_ID=postwoman-api
STORAGE_BUCKET=project-id.appspot.com STORAGE_BUCKET=postwoman-api.appspot.com
MESSAGING_SENDER_ID=sender-id MESSAGING_SENDER_ID=421993993223
APP_ID=app-id APP_ID=1:421993993223:web:ec0baa8ee8c02ffa1fc6a2
MEASUREMENT_ID=G-measurement-id MEASUREMENT_ID=G-ERJ6025CEB
# Base URL
BASE_URL=https://hoppscotch.io

View File

@@ -6,14 +6,14 @@ import { getSettingSubject, applySetting } from "~/newstore/settings"
// Initialize Firebase, copied from cloud console // Initialize Firebase, copied from cloud console
const firebaseConfig = { const firebaseConfig = {
apiKey: process.env.API_KEY || "AIzaSyCMsFreESs58-hRxTtiqQrIcimh4i1wbsM", apiKey: process.env.API_KEY,
authDomain: process.env.AUTH_DOMAIN || "postwoman-api.firebaseapp.com", authDomain: process.env.AUTH_DOMAIN,
databaseURL: process.env.DATABASE_URL || "https://postwoman-api.firebaseio.com", databaseURL: process.env.DATABASE_URL,
projectId: process.env.PROJECT_ID || "postwoman-api", projectId: process.env.PROJECT_ID,
storageBucket: process.env.STORAGE_BUCKET || "postwoman-api.appspot.com", storageBucket: process.env.STORAGE_BUCKET,
messagingSenderId: process.env.MESSAGING_SENDER_ID || "421993993223", messagingSenderId: process.env.MESSAGING_SENDER_ID,
appId: process.env.APP_ID || "1:421993993223:web:ec0baa8ee8c02ffa1fc6a2", appId: process.env.APP_ID,
measurementId: process.env.MEASUREMENT_ID || "G-ERJ6025CEB", measurementId: process.env.MEASUREMENT_ID,
} }
const historyLimit = 50 const historyLimit = 50

View File

@@ -1,3 +1,5 @@
require("dotenv").config()
// Common options // Common options
export const options = { export const options = {
name: "Hoppscotch", name: "Hoppscotch",
@@ -116,6 +118,8 @@ export default {
"@nuxtjs/google-fonts", "@nuxtjs/google-fonts",
// https://github.com/nuxt/typescript // https://github.com/nuxt/typescript
"@nuxt/typescript-build", "@nuxt/typescript-build",
// https://github.com/nuxt-community/dotenv-module
"@nuxtjs/dotenv",
], ],
// Modules (https://go.nuxtjs.dev/config-modules) // Modules (https://go.nuxtjs.dev/config-modules)
@@ -172,7 +176,7 @@ export default {
// Sitemap module configuration (https://github.com/nuxt-community/sitemap-module) // Sitemap module configuration (https://github.com/nuxt-community/sitemap-module)
sitemap: { sitemap: {
hostname: process.env.BASE_URL || "https://hoppscotch.io", hostname: process.env.BASE_URL,
}, },
// Robots module configuration (https://github.com/nuxt-community/robots-module) // Robots module configuration (https://github.com/nuxt-community/robots-module)
@@ -390,23 +394,4 @@ export default {
generate: { generate: {
fallback: true, fallback: true,
}, },
// Public runtime configuration (https://nuxtjs.org/guide/runtime-config)
publicRuntimeConfig: {
GA_ID: process.env.GA_ID || "UA-61422507-4",
GTM_ID: process.env.GTM_ID || "GTM-NMKVBMV",
BASE_URL: process.env.BASE_URL || "https://hoppscotch.io",
},
// Private runtime configuration (https://nuxtjs.org/guide/runtime-config)
privateRuntimeConfig: {
API_KEY: process.env.API_KEY,
AUTH_DOMAIN: process.env.AUTH_DOMAIN,
DATABASE_URL: process.env.DATABASE_URL,
PROJECT_ID: process.env.PROJECT_ID,
STORAGE_BUCKET: process.env.STORAGE_BUCKET,
MESSAGING_SENDER_ID: process.env.MESSAGING_SENDER_ID,
APP_ID: process.env.APP_ID,
MEASUREMENT_ID: process.env.MEASUREMENT_ID,
},
} }

38
package-lock.json generated
View File

@@ -44,6 +44,7 @@
"@nuxt/types": "^2.15.6", "@nuxt/types": "^2.15.6",
"@nuxt/typescript-build": "^2.1.0", "@nuxt/typescript-build": "^2.1.0",
"@nuxtjs/color-mode": "^2.0.5", "@nuxtjs/color-mode": "^2.0.5",
"@nuxtjs/dotenv": "^1.4.1",
"@nuxtjs/google-analytics": "^2.4.0", "@nuxtjs/google-analytics": "^2.4.0",
"@nuxtjs/google-fonts": "^1.3.0", "@nuxtjs/google-fonts": "^1.3.0",
"@nuxtjs/pwa": "^3.3.5", "@nuxtjs/pwa": "^3.3.5",
@@ -4326,6 +4327,25 @@
"lodash.template": "^4.5.0" "lodash.template": "^4.5.0"
} }
}, },
"node_modules/@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,
"dependencies": {
"consola": "^2.10.1",
"dotenv": "^8.1.0"
}
},
"node_modules/@nuxtjs/dotenv/node_modules/dotenv": {
"version": "8.6.0",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.6.0.tgz",
"integrity": "sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g==",
"dev": true,
"engines": {
"node": ">=10"
}
},
"node_modules/@nuxtjs/google-analytics": { "node_modules/@nuxtjs/google-analytics": {
"version": "2.4.0", "version": "2.4.0",
"resolved": "https://registry.npmjs.org/@nuxtjs/google-analytics/-/google-analytics-2.4.0.tgz", "resolved": "https://registry.npmjs.org/@nuxtjs/google-analytics/-/google-analytics-2.4.0.tgz",
@@ -38264,6 +38284,24 @@
"lodash.template": "^4.5.0" "lodash.template": "^4.5.0"
} }
}, },
"@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"
},
"dependencies": {
"dotenv": {
"version": "8.6.0",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.6.0.tgz",
"integrity": "sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g==",
"dev": true
}
}
},
"@nuxtjs/google-analytics": { "@nuxtjs/google-analytics": {
"version": "2.4.0", "version": "2.4.0",
"resolved": "https://registry.npmjs.org/@nuxtjs/google-analytics/-/google-analytics-2.4.0.tgz", "resolved": "https://registry.npmjs.org/@nuxtjs/google-analytics/-/google-analytics-2.4.0.tgz",

View File

@@ -56,6 +56,7 @@
"@nuxt/types": "^2.15.6", "@nuxt/types": "^2.15.6",
"@nuxt/typescript-build": "^2.1.0", "@nuxt/typescript-build": "^2.1.0",
"@nuxtjs/color-mode": "^2.0.5", "@nuxtjs/color-mode": "^2.0.5",
"@nuxtjs/dotenv": "^1.4.1",
"@nuxtjs/google-analytics": "^2.4.0", "@nuxtjs/google-analytics": "^2.4.0",
"@nuxtjs/google-fonts": "^1.3.0", "@nuxtjs/google-fonts": "^1.3.0",
"@nuxtjs/pwa": "^3.3.5", "@nuxtjs/pwa": "^3.3.5",