dotenv

This commit is contained in:
Liyas Thomas
2020-05-10 12:10:17 +05:30
parent 80d0925ed7
commit d4aa3699f2
5 changed files with 50 additions and 18 deletions

15
.env.example Normal file
View File

@@ -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

View File

@@ -4,14 +4,14 @@ import "firebase/auth"
// Initialize Firebase, copied from cloud console // Initialize Firebase, copied from cloud console
const firebaseConfig = { const firebaseConfig = {
apiKey: "AIzaSyCMsFreESs58-hRxTtiqQrIcimh4i1wbsM", apiKey: process.env.API_KEY,
authDomain: "postwoman-api.firebaseapp.com", authDomain: process.env.AUTH_DOMAIN,
databaseURL: "https://postwoman-api.firebaseio.com", databaseURL: process.env.DATABASE_URL,
projectId: "postwoman-api", projectId: process.env.PROJECT_ID,
storageBucket: "postwoman-api.appspot.com", storageBucket: process.env.STORAGE_BUCKET,
messagingSenderId: "421993993223", messagingSenderId: process.env.MESSAGING_SENDER_ID,
appId: "1:421993993223:web:ec0baa8ee8c02ffa1fc6a2", appId: process.env.APP_ID,
measurementId: "G-ERJ6025CEB", measurementId: process.env.MEASUREMENT_ID,
} }
firebase.initializeApp(firebaseConfig) firebase.initializeApp(firebaseConfig)

View File

@@ -1,3 +1,4 @@
require("dotenv").config()
// Some helpful application constants. // Some helpful application constants.
// TODO: Use these when rendering the pages (rather than just for head/meta tags...) // TODO: Use these when rendering the pages (rather than just for head/meta tags...)
export const options = { export const options = {
@@ -147,19 +148,18 @@ export default {
/* /*
** Nuxt.js dev-modules ** Nuxt.js dev-modules
*/ */
buildModules: ["@nuxtjs/gtm"], buildModules: ["@nuxtjs/gtm", "@nuxtjs/dotenv", "@nuxtjs/google-analytics"],
/* /*
** Nuxt.js modules ** Nuxt.js modules
*/ */
modules: [ modules: [
// See https://goo.gl/OOhYW5 // See https://goo.gl/OOhYW5
["@nuxtjs/pwa"], "@nuxtjs/pwa",
["@nuxtjs/axios"], "@nuxtjs/axios",
["@nuxtjs/toast"], "@nuxtjs/toast",
["@nuxtjs/google-analytics"], "@nuxtjs/sitemap",
["@nuxtjs/sitemap"], "@nuxtjs/robots",
["@nuxtjs/robots"], "nuxt-i18n",
["nuxt-i18n"],
], ],
pwa: { pwa: {
manifest: { manifest: {
@@ -188,10 +188,10 @@ export default {
keepOnHover: true, keepOnHover: true,
}, },
googleAnalytics: { googleAnalytics: {
id: process.env.GA_ID || "UA-61422507-2", id: process.env.GA_ID,
}, },
gtm: { gtm: {
id: process.env.GTM_ID || "GTM-MXWD8NQ", id: process.env.GTM_ID,
}, },
sitemap: { sitemap: {
hostname: "https://postwoman.io", hostname: "https://postwoman.io",

16
package-lock.json generated
View File

@@ -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": { "@nuxtjs/google-analytics": {
"version": "2.2.3", "version": "2.2.3",
"resolved": "https://registry.npmjs.org/@nuxtjs/google-analytics/-/google-analytics-2.2.3.tgz", "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": { "duplexer": {
"version": "0.1.1", "version": "0.1.1",
"resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz",

View File

@@ -53,6 +53,7 @@
"yargs-parser": "^18.1.3" "yargs-parser": "^18.1.3"
}, },
"devDependencies": { "devDependencies": {
"@nuxtjs/dotenv": "^1.4.1",
"@nuxtjs/google-analytics": "^2.2.3", "@nuxtjs/google-analytics": "^2.2.3",
"cypress": "^4.5.0", "cypress": "^4.5.0",
"eslint": "^6.8.0", "eslint": "^6.8.0",