Add env variables for frontend
This commit is contained in:
parent
4f792e242d
commit
2b6c7a4025
9 changed files with 45 additions and 2 deletions
4
.env.sample
Normal file
4
.env.sample
Normal file
|
@ -0,0 +1,4 @@
|
|||
pusher_cluster=
|
||||
pusher_key=
|
||||
|
||||
fb_app_id=
|
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -26,3 +26,6 @@ config/database.yml
|
|||
node_modules
|
||||
|
||||
*.rdb
|
||||
|
||||
# Ignore env files
|
||||
.env
|
||||
|
|
|
@ -12,6 +12,9 @@ bundle
|
|||
# copy database config
|
||||
cp shared/config/database.yml config/database.yml
|
||||
|
||||
# copy frontend env file
|
||||
cp .env.sample .env
|
||||
|
||||
# run db migrations
|
||||
bundle exec rake db:migrate
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
export default {
|
||||
APP_BASE_URL: '/',
|
||||
PUSHER: 'test',
|
||||
PUSHER: __PUSHER__,
|
||||
get apiURL() {
|
||||
return `${this.APP_BASE_URL}/`;
|
||||
},
|
||||
|
|
|
@ -59,7 +59,6 @@ const authIgnoreRoutes = [
|
|||
|
||||
|
||||
const redirectUser = (to, from, next) => {
|
||||
console.log(to);
|
||||
// If auth ignore go to page
|
||||
if (authIgnoreRoutes.indexOf(to.name) > -1) {
|
||||
return next();
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
process.env.NODE_ENV = process.env.NODE_ENV || 'development'
|
||||
|
||||
const dotenv = require('dotenv')
|
||||
dotenv.config({ path: '.env', silent: true })
|
||||
|
||||
const environment = require('./environment')
|
||||
|
||||
module.exports = environment.toWebpackConfig()
|
||||
|
|
|
@ -2,6 +2,8 @@ const { environment } = require('@rails/webpacker')
|
|||
const { VueLoaderPlugin } = require('vue-loader')
|
||||
const vue = require('./loaders/vue')
|
||||
const path = require('path')
|
||||
const webpack = require('webpack')
|
||||
|
||||
environment.plugins.prepend('VueLoaderPlugin', new VueLoaderPlugin())
|
||||
environment.loaders.prepend('vue', vue)
|
||||
environment.loaders.append('audio', {
|
||||
|
@ -24,4 +26,14 @@ const resolve = {
|
|||
|
||||
environment.config.merge({ resolve });
|
||||
|
||||
const { pusher_cluster: cluster, pusher_key: token, fb_app_id: fbAppID } = process.env
|
||||
|
||||
environment.plugins.prepend('DefinePlugin', new webpack.DefinePlugin({
|
||||
__PUSHER__: {
|
||||
token: `"${token}"`,
|
||||
cluster: `"${cluster}"`,
|
||||
},
|
||||
__FB_ID__: `"${fbAppID}"`,
|
||||
}))
|
||||
|
||||
module.exports = environment
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
"axios": "~0.15.3",
|
||||
"bourbon": "~4.2.7",
|
||||
"chart.js": "~2.5.0",
|
||||
"dotenv": "^8.0.0",
|
||||
"emojione": "~2.2.7",
|
||||
"foundation-sites": "6.3.0",
|
||||
"ionicons": "~3.0.0",
|
||||
|
|
18
yarn.lock
18
yarn.lock
|
@ -2872,6 +2872,11 @@ dot-prop@^4.1.1:
|
|||
dependencies:
|
||||
is-obj "^1.0.0"
|
||||
|
||||
dotenv@^8.0.0:
|
||||
version "8.0.0"
|
||||
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-8.0.0.tgz#ed310c165b4e8a97bb745b0a9d99c31bda566440"
|
||||
integrity sha512-30xVGqjLjiUOArT4+M5q9sYdvuR4riM6yK9wMcas9Vbp6zZa+ocC9dp6QoftuhTPhFAiLK/0C5Ni2nou/Bk8lg==
|
||||
|
||||
duplexify@^3.4.2, duplexify@^3.6.0:
|
||||
version "3.7.1"
|
||||
resolved "https://registry.yarnpkg.com/duplexify/-/duplexify-3.7.1.tgz#2a4df5317f6ccfd91f86d6fd25d8d8a103b88309"
|
||||
|
@ -4391,6 +4396,11 @@ lodash._reinterpolate@~3.0.0:
|
|||
resolved "https://registry.yarnpkg.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d"
|
||||
integrity sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0=
|
||||
|
||||
lodash.defaults@^4.2.0:
|
||||
version "4.2.0"
|
||||
resolved "https://registry.yarnpkg.com/lodash.defaults/-/lodash.defaults-4.2.0.tgz#d09178716ffea4dde9e5fb7b37f6f0802274580c"
|
||||
integrity sha1-0JF4cW/+pN3p5ft7N/bwgCJ0WAw=
|
||||
|
||||
lodash.get@^4.0:
|
||||
version "4.4.2"
|
||||
resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99"
|
||||
|
@ -6219,6 +6229,14 @@ querystringify@^2.1.1:
|
|||
resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.1.1.tgz#60e5a5fd64a7f8bfa4d2ab2ed6fdf4c85bad154e"
|
||||
integrity sha512-w7fLxIRCRT7U8Qu53jQnJyPkYZIaR4n5151KMfcJlO/A9397Wxb1amJvROTK6TOnp7PfoAmg/qXiNHI+08jRfA==
|
||||
|
||||
rails-erb-loader@^5.5.2:
|
||||
version "5.5.2"
|
||||
resolved "https://registry.yarnpkg.com/rails-erb-loader/-/rails-erb-loader-5.5.2.tgz#db3fa8ac89600f09d179a1a70a2ca18c592576ea"
|
||||
integrity sha512-cjQH9SuSvRPhnWkvjmmAW/S4AFVDfAtYnQO4XpKJ8xpRdZayT73iXoE+IPc3VzN03noZXhVmyvsCvKvHj4LY6w==
|
||||
dependencies:
|
||||
loader-utils "^1.1.0"
|
||||
lodash.defaults "^4.2.0"
|
||||
|
||||
randombytes@^2.0.0, randombytes@^2.0.1, randombytes@^2.0.5:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a"
|
||||
|
|
Loading…
Reference in a new issue