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

View File

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

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": {
"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",

View File

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