Skip to content

Commit

Permalink
⚡ Use dotenv
Browse files Browse the repository at this point in the history
  • Loading branch information
taishikato committed Mar 20, 2020
1 parent ab31538 commit 3af1f2f
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 10 deletions.
7 changes: 7 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FIREBASE_API_KEY=
FIREBASE_AUTH_DOMAIN=
FIREBASE_DATABASE_URL=
FIREBASE_PROJECT_ID=
FIREBASE_STORAGE_BUCKET=
FIREBASE_MESSAGING_SENDER_ID=
FIREBASE_APP_ID=
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

# misc
.DS_Store
.env*
.env

# debug
npm-debug.log*
Expand Down
14 changes: 12 additions & 2 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@

require('dotenv').config()
const withCSS = require('@zeit/next-css')
// const withImages = require('next-images')
// const withOffline = require('next-offline')

module.exports = withCSS({})
module.exports = withCSS({
env: {
'FIREBASE_API_KEY': process.env.FIREBASE_API_KEY,
'FIREBASE_AUTH_DOMAIN': process.env.FIREBASE_AUTH_DOMAIN,
'FIREBASE_DATABASE_URL': process.env.FIREBASE_DATABASE_URL,
'FIREBASE_PROJECT_ID': process.env.FIREBASE_PROJECT_ID,
'FIREBASE_STORAGE_BUCKET': process.env.FIREBASE_STORAGE_BUCKET,
'FIREBASE_MESSAGING_SENDER_ID': process.env.FIREBASE_MESSAGING_SENDER_ID,
'FIREBASE_APP_ID': process.env.FIREBASE_APP_ID
}
})
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"@zeit/next-css": "^1.0.1",
"algoliasearch": "^4.0.1",
"antd": "^3.26.7",
"dotenv": "^8.2.0",
"firebase": "^7.7.0",
"markdown-it": "^10.0.0",
"moment": "^2.24.0",
Expand Down
14 changes: 7 additions & 7 deletions plugins/firebase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import firebase from 'firebase/app'

if (!firebase.apps.length) {
firebase.initializeApp({
apiKey: 'AIzaSyDYEn7zIIDX9jqXDrToNwBPsJ0g0Hxn7tw',
authDomain: 'ask-makers.firebaseapp.com',
databaseURL: 'https://ask-makers.firebaseio.com',
projectId: 'ask-makers',
storageBucket: 'ask-makers.appspot.com',
messagingSenderId: '811327399022',
appId: '1:811327399022:web:60a82580178913a0'
apiKey: process.env.FIREBASE_API_KEY,
authDomain: process.env.FIREBASE_AUTH_DOMAIN,
databaseURL: process.env.FIREBASE_DATABASE_URL,
projectId: process.env.FIREBASE_PROJECT_ID,
storageBucket: process.env.FIREBASE_STORAGE_BUCKET,
messagingSenderId: process.env.FIREBASE_MESSAGING_SENDER_ID,
appId: process.env.FIREBASE_APP_ID
})
}
export default firebase
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3241,6 +3241,11 @@ dot-prop@^5.0.0:
dependencies:
is-obj "^2.0.0"

dotenv@^8.2.0:
version "8.2.0"
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-8.2.0.tgz#97e619259ada750eea3e4ea3e26bceea5424b16a"
integrity sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw==

draft-js@^0.10.0, draft-js@~0.10.0:
version "0.10.5"
resolved "https://registry.yarnpkg.com/draft-js/-/draft-js-0.10.5.tgz#bfa9beb018fe0533dbb08d6675c371a6b08fa742"
Expand Down

0 comments on commit 3af1f2f

Please sign in to comment.