fix env vars

This commit is contained in:
Matteo Pagliazzi
2019-10-02 11:16:31 +02:00
parent 86dbc23f3c
commit 211da982b3
18 changed files with 64 additions and 24 deletions

View File

@@ -6776,6 +6776,11 @@
"integrity": "sha512-zzK8+ByrzvOL6N92hRewwUKL0wN0TOaIuUjX0Jj8lraxWvr5wHYs2YTjaj2lstF+8qMv5cmPPef47va8NT8lDw==", "integrity": "sha512-zzK8+ByrzvOL6N92hRewwUKL0wN0TOaIuUjX0Jj8lraxWvr5wHYs2YTjaj2lstF+8qMv5cmPPef47va8NT8lDw==",
"dev": true "dev": true
}, },
"jquery": {
"version": "3.4.1",
"resolved": "https://registry.npmjs.org/jquery/-/jquery-3.4.1.tgz",
"integrity": "sha512-36+AdBzCL+y6qjw5Tx7HgzeGCzC81MDDgaUP8ld2zhx58HdqXGoBd+tHdrBMiyjGQs0Hxs/MLZTu/eHNJJuWPw=="
},
"js-levenshtein": { "js-levenshtein": {
"version": "1.1.6", "version": "1.1.6",
"resolved": "https://registry.npmjs.org/js-levenshtein/-/js-levenshtein-1.1.6.tgz", "resolved": "https://registry.npmjs.org/js-levenshtein/-/js-levenshtein-1.1.6.tgz",

View File

@@ -18,6 +18,7 @@
"habitica-markdown": "^1.3.0", "habitica-markdown": "^1.3.0",
"hellojs": "^1.18.1", "hellojs": "^1.18.1",
"intro.js": "^2.9.3", "intro.js": "^2.9.3",
"jquery": "^3.4.1",
"smartbanner.js": "^1.14.5", "smartbanner.js": "^1.14.5",
"vue": "^2.6.10", "vue": "^2.6.10",
"vue-mugen-scroll": "^0.2.6", "vue-mugen-scroll": "^0.2.6",
@@ -40,6 +41,7 @@
"pug-plain-loader": "^1.0.0", "pug-plain-loader": "^1.0.0",
"sass": "^1.19.0", "sass": "^1.19.0",
"sass-loader": "^8.0.0", "sass-loader": "^8.0.0",
"vue-template-compiler": "^2.6.10" "vue-template-compiler": "^2.6.10",
"webpack": "^4.41.0"
} }
} }

View File

@@ -198,7 +198,7 @@ import { CONSTANTS, getLocalSetting, removeLocalSetting } from '@/libs/userlocal
import svgClose from '@/assets/svg/close.svg'; import svgClose from '@/assets/svg/close.svg';
import bannedAccountModal from '@/components/bannedAccountModal'; import bannedAccountModal from '@/components/bannedAccountModal';
const COMMUNITY_MANAGER_EMAIL = process.env.EMAILS.COMMUNITY_MANAGER_EMAIL; // eslint-disable-line const COMMUNITY_MANAGER_EMAIL = process.env.EMAILS_COMMUNITY_MANAGER_EMAIL; // eslint-disable-line
export default { export default {
mixins: [notifications, spellsMixin], mixins: [notifications, spellsMixin],
@@ -247,7 +247,7 @@ export default {
const min = 1; const min = 1;
const randomNumber = Math.random() * (numberOfTips - min) + min; const randomNumber = Math.random() * (numberOfTips - min) + min;
const tipNumber = Math.floor(randomNumber); const tipNumber = Math.floor(randomNumber);
this.currentTipNumber = tipNumber; this.currentTipNumber = tipNumber; // eslint-disable-line vue/no-side-effects-in-computed-properties
return this.$t(`tip${tipNumber}`); return this.$t(`tip${tipNumber}`);
}, },

View File

@@ -180,6 +180,8 @@ export default {
if (!this.avatarOnly && this.member.items.currentMount && this.member.items.currentMount.indexOf('Kangaroo') !== -1) { if (!this.avatarOnly && this.member.items.currentMount && this.member.items.currentMount.indexOf('Kangaroo') !== -1) {
return 'offset-kangaroo'; return 'offset-kangaroo';
} }
return null;
}, },
}, },
methods: { methods: {

View File

@@ -15,7 +15,7 @@
<script> <script>
import markdownDirective from '@/directives/markdown'; import markdownDirective from '@/directives/markdown';
const COMMUNITY_MANAGER_EMAIL = process.env.EMAILS.COMMUNITY_MANAGER_EMAIL; // eslint-disable-line const COMMUNITY_MANAGER_EMAIL = process.env.EMAILS_COMMUNITY_MANAGER_EMAIL; // eslint-disable-line
export default { export default {
directives: { directives: {

View File

@@ -110,8 +110,8 @@ export default {
searchResults () { searchResults () {
if (!this.searchActive) return []; if (!this.searchActive) return [];
if (!this.atRegex.exec(this.text)) return []; if (!this.atRegex.exec(this.text)) return [];
this.currentSearch = this.atRegex.exec(this.text)[0]; this.currentSearch = this.atRegex.exec(this.text)[0]; // eslint-disable-line vue/no-side-effects-in-computed-properties
this.currentSearch = this.currentSearch.substring(1, this.currentSearch.length); this.currentSearch = this.currentSearch.substring(1, this.currentSearch.length); // eslint-disable-line vue/no-side-effects-in-computed-properties
return this.tmpSelections.filter((option) => { return this.tmpSelections.filter((option) => {
return option.displayName.toLowerCase().indexOf(this.currentSearch.toLowerCase()) !== -1 || option.username && option.username.toLowerCase().indexOf(this.currentSearch.toLowerCase()) !== -1; return option.displayName.toLowerCase().indexOf(this.currentSearch.toLowerCase()) !== -1 || option.username && option.username.toLowerCase().indexOf(this.currentSearch.toLowerCase()) !== -1;

View File

@@ -333,7 +333,7 @@ export default {
each(this.gearTypesToStrings, (string, type) => { each(this.gearTypesToStrings, (string, type) => {
this.viewOptions[type].firstRender = false; this.viewOptions[type].firstRender = false; // eslint-disable-line vue/no-side-effects-in-computed-properties
}); });
return gearItemsByType; return gearItemsByType;
@@ -372,7 +372,7 @@ export default {
}); });
each(this.gearClassesToStrings, (string, klass) => { each(this.gearClassesToStrings, (string, klass) => {
this.viewOptions[klass].firstRender = false; this.viewOptions[klass].firstRender = false; // eslint-disable-line vue/no-side-effects-in-computed-properties
}); });
return gearItemsByClass; return gearItemsByClass;

View File

@@ -8,8 +8,6 @@ import { mapState } from '@/libs/store';
import uuid from 'uuid'; import uuid from 'uuid';
import paymentsMixin from '@/mixins/payments'; import paymentsMixin from '@/mixins/payments';
const AMAZON_PAYMENTS = process.env.AMAZON_PAYMENTS; // eslint-disable-line
export default { export default {
mixins: [paymentsMixin], mixins: [paymentsMixin],
data () { data () {
@@ -77,7 +75,7 @@ export default {
showButton () { showButton () {
window.OffAmazonPayments.Button( // eslint-disable-line new-cap window.OffAmazonPayments.Button( // eslint-disable-line new-cap
this.buttonId, // ID of the button this.buttonId, // ID of the button
AMAZON_PAYMENTS.SELLER_ID, process.env.AMAZON_PAYMENTS_SELLER_ID,
{ {
type: 'PwA', type: 'PwA',
color: 'Gold', color: 'Gold',

View File

@@ -35,7 +35,6 @@ import { mapState } from '@/libs/store';
import { CONSTANTS, setLocalSetting } from '@/libs/userlocalManager'; import { CONSTANTS, setLocalSetting } from '@/libs/userlocalManager';
import pick from 'lodash/pick'; import pick from 'lodash/pick';
const AMAZON_PAYMENTS = process.env.AMAZON_PAYMENTS; // eslint-disable-line
const habiticaUrl = `${location.protocol}//${location.host}`; const habiticaUrl = `${location.protocol}//${location.host}`;
export default { export default {
@@ -108,7 +107,7 @@ export default {
methods: { methods: {
amazonInitWidgets () { amazonInitWidgets () {
let walletParams = { let walletParams = {
sellerId: AMAZON_PAYMENTS.SELLER_ID, // @TODO: Import sellerId: process.env.AMAZON_PAYMENTS_SELLER_ID, // @TODO: Import
design: { design: {
designMode: 'responsive', designMode: 'responsive',
}, },
@@ -123,7 +122,7 @@ export default {
this.amazonPayments.billingAgreementId = billingAgreement.getAmazonBillingAgreementId(); this.amazonPayments.billingAgreementId = billingAgreement.getAmazonBillingAgreementId();
new window.OffAmazonPayments.Widgets.Consent({ new window.OffAmazonPayments.Widgets.Consent({
sellerId: AMAZON_PAYMENTS.SELLER_ID, sellerId: process.env.AMAZON_PAYMENTS_SELLER_ID,
amazonBillingAgreementId: this.amazonPayments.billingAgreementId, amazonBillingAgreementId: this.amazonPayments.billingAgreementId,
design: { design: {
designMode: 'responsive', designMode: 'responsive',

View File

@@ -402,7 +402,7 @@
// If we are out of gear, show the spells // If we are out of gear, show the spells
// @TODO: add dates to check instead? // @TODO: add dates to check instead?
if (seasonal.featured.items.length === 0) { if (seasonal.featured.items.length === 0) {
this.featuredGearBought = true; this.featuredGearBought = true; // eslint-disable-line vue/no-side-effects-in-computed-properties
if (seasonal.categories.length > 0) { if (seasonal.categories.length > 0) {
seasonal.featured.items = seasonal.featured.items.concat(seasonal.categories[0].items); seasonal.featured.items = seasonal.featured.items.concat(seasonal.categories[0].items);
} }

View File

@@ -215,6 +215,7 @@ div
computed: { computed: {
showNotes () { showNotes () {
if (['armoire', 'potion'].indexOf(this.item.path) > -1) return true; if (['armoire', 'potion'].indexOf(this.item.path) > -1) return true;
return false;
}, },
currencyClass () { currencyClass () {
if (this.item.currency && this.icons[this.item.currency]) { if (this.item.currency && this.icons[this.item.currency]) {

View File

@@ -43,6 +43,8 @@ export default {
return this.$t('userCountRequestsApproval', {userCount: approvalsLength}); return this.$t('userCountRequestsApproval', {userCount: approvalsLength});
} else if (approvalsLength === 1 && userIsRequesting || this.task.group.approval && this.task.group.approval.requested && !this.task.group.approval.approved) { } else if (approvalsLength === 1 && userIsRequesting || this.task.group.approval && this.task.group.approval.requested && !this.task.group.approval.approved) {
return this.$t('youAreRequestingApproval'); return this.$t('youAreRequestingApproval');
} else {
return null;
} }
}, },
userIsAdmin () { userIsAdmin () {

View File

@@ -790,6 +790,8 @@ export default {
return task.everyX === 1 ? this.$t('month') : this.$t('months'); return task.everyX === 1 ? this.$t('month') : this.$t('months');
} else if (task.frequency === 'yearly') { } else if (task.frequency === 'yearly') {
return task.everyX === 1 ? this.$t('year') : this.$t('years'); return task.everyX === 1 ? this.$t('year') : this.$t('years');
} else {
return null;
} }
}, },
repeatsOn: { repeatsOn: {

View File

@@ -377,10 +377,9 @@ export default {
// Vue-subscribe to changes // Vue-subscribe to changes
const subScribeToUpdate = this.messagesLoading || this.updateConversionsCounter > -1; const subScribeToUpdate = this.messagesLoading || this.updateConversionsCounter > -1;
const selectedConversationKey = this.selectedConversation.key; const selectedConversationKey = this.selectedConversation.key;
const selectedConversation = this.messagesByConversation[selectedConversationKey]; const selectedConversation = this.messagesByConversation[selectedConversationKey];
this.messages = selectedConversation || []; this.messages = selectedConversation || []; // eslint-disable-line vue/no-side-effects-in-computed-properties
const ordered = orderBy(this.messages, [(m) => { const ordered = orderBy(this.messages, [(m) => {
return m.timestamp; return m.timestamp;
@@ -389,6 +388,8 @@ export default {
if (subScribeToUpdate) { if (subScribeToUpdate) {
return ordered; return ordered;
} }
return [];
}, },
filtersConversations () { filtersConversations () {
// Vue-subscribe to changes // Vue-subscribe to changes

View File

@@ -68,7 +68,7 @@ export default {
computed: { computed: {
...mapState({user: 'user.data'}), ...mapState({user: 'user.data'}),
tasksByType () { tasksByType () {
this.dueDate = moment().subtract(1, 'days'); this.dueDate = moment().subtract(1, 'days'); // eslint-disable-line vue/no-side-effects-in-computed-properties
return { return {
daily: this.yesterDailies, daily: this.yesterDailies,

View File

@@ -1,7 +1,5 @@
import getStore from '@/store'; import getStore from '@/store';
const AMAZON_PAYMENTS = process.env.AMAZON_PAYMENTS; // eslint-disable-line
const NODE_ENV = process.env.NODE_ENV; // eslint-disable-line
export function setup () { export function setup () {
const store = getStore(); const store = getStore();
@@ -10,7 +8,7 @@ export function setup () {
// Added here to make sure the listener is registered before the script can be executed // Added here to make sure the listener is registered before the script can be executed
window.onAmazonLoginReady = () => { window.onAmazonLoginReady = () => {
store.state.isAmazonReady = true; store.state.isAmazonReady = true;
window.amazon.Login.setClientId(AMAZON_PAYMENTS.CLIENT_ID); window.amazon.Login.setClientId(process.env.AMAZON_PAYMENTS_CLIENT_ID);
}; };
// Load the scripts // Load the scripts
@@ -20,7 +18,7 @@ export function setup () {
let firstScript = document.getElementsByTagName('script')[0]; let firstScript = document.getElementsByTagName('script')[0];
amazonScript.type = 'text/javascript'; amazonScript.type = 'text/javascript';
amazonScript.async = true; amazonScript.async = true;
amazonScript.src = `https://static-na.payments-amazon.com/OffAmazonPayments/us/${(AMAZON_PAYMENTS.MODE === 'sandbox' ? 'sandbox/' : '')}js/Widgets.js`; amazonScript.src = `https://static-na.payments-amazon.com/OffAmazonPayments/us/${(process.env.AMAZON_PAYMENTS_MODE === 'sandbox' ? 'sandbox/' : '')}js/Widgets.js`;
firstScript.parentNode.insertBefore(amazonScript, firstScript); firstScript.parentNode.insertBefore(amazonScript, firstScript);
// Stripe // Stripe

View File

@@ -4,7 +4,7 @@ import { getDropClass, getXPMessage, getSign, round } from '@/libs/notifications
// See https://stackoverflow.com/questions/4187146/truncate-number-to-two-decimal-places-without-rounding // See https://stackoverflow.com/questions/4187146/truncate-number-to-two-decimal-places-without-rounding
function toFixedWithoutRounding (num, fixed) { function toFixedWithoutRounding (num, fixed) {
const re = new RegExp(`^-?\\d+(?:\.\\d{0,${(fixed || -1)}})?`); const re = new RegExp(`^-?\\d+(?:\.\\d{0,${(fixed || -1)}})?`); // eslint-disable-line no-useless-escape
return num.toString().match(re)[0]; return num.toString().match(re)[0];
} }

View File

@@ -1,15 +1,45 @@
// TODO abstract from server
const path = require('path'); const path = require('path');
const webpack = require('webpack');
const nconf = require('nconf'); const nconf = require('nconf');
const setupNconf = require('../../website/server/libs/setupNconf'); const setupNconf = require('../../website/server/libs/setupNconf');
let configFile = path.join(path.resolve(__dirname, '../../config.json')); let configFile = path.join(path.resolve(__dirname, '../../config.json'));
// TODO abstract from server
setupNconf(configFile); setupNconf(configFile);
const DEV_BASE_URL = nconf.get('BASE_URL'); const DEV_BASE_URL = nconf.get('BASE_URL');
const envVars = [
'AMAZON_PAYMENTS_SELLER_ID',
'AMAZON_PAYMENTS_CLIENT_ID',
'AMAZON_PAYMENTS_MODE',
'EMAILS_COMMUNITY_MANAGER_EMAIL',
'EMAILS_TECH_ASSISTANCE_EMAIL',
'EMAILS_PRESS_ENQUIRY_EMAIL',
'BASE_URL',
'GA_ID',
'STRIPE_PUB_KEY',
'FACEBOOK_KEY',
'GOOGLE_CLIENT_ID',
'AMPLITUDE_KEY',
'LOGGLY_CLIENT_TOKEN',
// TODO necessary? if yes how not to mess up with vue cli? 'NODE_ENV'
];
const envObject = {};
envVars
.forEach(key => {
envObject[key] = nconf.get(key);
});
module.exports = { module.exports = {
configureWebpack: {
plugins: [
new webpack.EnvironmentPlugin(envObject)
],
},
chainWebpack: config => { chainWebpack: config => {
const pugRule = config.module.rule('pug') const pugRule = config.module.rule('pug')