diff --git a/package.json b/package.json index be176be5afbb7e6dd41099c69df0dbab6b7a97a9..3e5c43d1a907ab0bd8fd953e2bced1fae6599cde 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "@vue/test-utils": "1.0.0-beta.29", "babel-eslint": "^10.0.1", "chai": "^4.1.2", + "dotenv-webpack": "^1.7.0", "eslint": "^5.16.0", "eslint-plugin-vue": "^5.0.0", "vue-template-compiler": "^2.6.10" diff --git a/src/components/Suggestions.vue b/src/components/Suggestions.vue index 6ae68ce521fb982d5b4471a666a4c87d41d2fef3..ce426ea62657278276093de166083200ec1faece 100644 --- a/src/components/Suggestions.vue +++ b/src/components/Suggestions.vue @@ -60,6 +60,7 @@ <script> import sources from '@/sources' +import config from '@/config' import orderBy from 'lodash/orderBy' import pull from 'lodash/pull' import chunk from 'lodash/chunk' @@ -93,8 +94,8 @@ export default { let self = this let suggestions = this.allSuggestions.filter((s) => { let f = true - if (self.filters.retributeOnly) { - f = !!this.retributeProfiles[s.fullId] + if (self.filters.retributeOnly != null) { + f = !!this.retributeProfiles[s.fullId] === self.filters.retributeOnly } return f }) @@ -191,7 +192,7 @@ export default { self.loadingRetributeProfiles.push(id) }) const client = axios.create() - let url = `http://localhost:8000/api/v1/search/` + let url = config.RetributeAPIUrl + `v1/search/` let response try { response = await client.post(url, {lookups: ids}) @@ -209,7 +210,7 @@ export default { async lookup (id) { this.loadingRetributeProfiles.push(id) const client = axios.create() - let url = `http://localhost:8000/api/v1/search/${id}` + let url = config.RetributeAPIUrl + `v1/search/${id}` try { const response = await client.get(url) this.$set(this.retributeProfiles, id, response.data) diff --git a/src/config.js b/src/config.js new file mode 100644 index 0000000000000000000000000000000000000000..e0ff8ad10cf02ff3175141c695b2831a3e811e94 --- /dev/null +++ b/src/config.js @@ -0,0 +1,3 @@ +export default { + RetributeAPIUrl: process.env.RETRIBUTE_API_URL || 'https://api.retribute.me/' +} diff --git a/vue.config.js b/vue.config.js new file mode 100644 index 0000000000000000000000000000000000000000..2096ab47e7806e15f62bec0f6f891c4b8d5671b6 --- /dev/null +++ b/vue.config.js @@ -0,0 +1,9 @@ +const Dotenv = require('dotenv-webpack'); + +module.exports = { + configureWebpack: { + plugins: [ + new Dotenv() + ] + } +} diff --git a/yarn.lock b/yarn.lock index c2858a28ef0c77a021d0ac847d4c242458bfa8db..07e19752f3c201f869089a38ac52d16671a743f3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2966,11 +2966,30 @@ dot-prop@^4.1.1: dependencies: is-obj "^1.0.0" +dotenv-defaults@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/dotenv-defaults/-/dotenv-defaults-1.0.2.tgz#441cf5f067653fca4bbdce9dd3b803f6f84c585d" + integrity sha512-iXFvHtXl/hZPiFj++1hBg4lbKwGM+t/GlvELDnRtOFdjXyWP7mubkVr+eZGWG62kdsbulXAef6v/j6kiWc/xGA== + dependencies: + dotenv "^6.2.0" + dotenv-expand@^5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/dotenv-expand/-/dotenv-expand-5.1.0.tgz#3fbaf020bfd794884072ea26b1e9791d45a629f0" integrity sha512-YXQl1DSa4/PQyRfgrv6aoNjhasp/p4qs9FjJ4q4cQk+8m4r6k4ZSiEyytKG8f8W9gi8WsQtIObNmKd+tMzNTmA== +dotenv-webpack@^1.7.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/dotenv-webpack/-/dotenv-webpack-1.7.0.tgz#4384d8c57ee6f405c296278c14a9f9167856d3a1" + integrity sha512-wwNtOBW/6gLQSkb8p43y0Wts970A3xtNiG/mpwj9MLUhtPCQG6i+/DSXXoNN7fbPCU/vQ7JjwGmgOeGZSSZnsw== + dependencies: + dotenv-defaults "^1.0.2" + +dotenv@^6.2.0: + version "6.2.0" + resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-6.2.0.tgz#941c0410535d942c8becf28d3f357dbd9d476064" + integrity sha512-HygQCKUBSFl8wKQZBSemMywRWcEDNidvNbjGVyZu3nbZ8qq9ubiPoGLMdRDpfSrpkkm9BXYFkpKxxFX38o/76w== + dotenv@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-7.0.0.tgz#a2be3cd52736673206e8a85fb5210eea29628e7c"