Skip to content

Commit

Permalink
Client uses env files
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffSpies committed Mar 23, 2020
1 parent a2ad977 commit 865ae93
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 8 deletions.
11 changes: 9 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ ifeq (,$(shell which quasar))
npm -g install quasar
endif

install_js:
cd client && yarn && cd ..
cd server && yarn && cd ..
cd ingest && yarn && cd ..

cleardb:
docker-compose down -v
migrate:
Expand All @@ -29,8 +34,8 @@ newdb:
cd ingest && ts-node loadAuthors.ts && cd ..
cd ingest && ts-node ingestMetadataByDoi.ts && cd ..

install: install_docker_compose install_hasura_cli install_yarn install_quasar
cd client && yarn && cd ..
install: install_docker_compose install_hasura_cli install_yarn install_quasar install_js
echo 'Installing'

start_docker:
docker-compose up -d
Expand All @@ -39,6 +44,8 @@ stop_docker:

client:
cd client && quasar dev && cd ..
server:
cd server && ts-node index.tx && cd ..

This comment has been minimized.

Copy link
@JeffSpies

JeffSpies Mar 23, 2020

Author Contributor

tx -> ts

docker:
docker-compose up

Expand Down
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,14 @@ Publication Activity Collection Environment Admin Tools and DB

make docker
make client
make migration_console
make server
make migration_console

It's worth running ``make install_js`` every now and then to make sure your packages are up-to-date.

# Production

You may need to change the following variables in your .env file

GRAPHQL_END_POINT=http://localhost:8002/v1/graphql
IMAGE_HOST_URL=http://localhost:8000/
2 changes: 2 additions & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"apollo-link-context": "^1.0.19",
"axios": "^0.18.1",
"citation-js": "^0.5.0-alpha.5",
"dotenv": "^8.2.0",
"graphql-tag": "^2.10.3",
"node-fetch": "^2.6.0",
"quasar": "^1.0.0",
Expand All @@ -26,6 +27,7 @@
},
"devDependencies": {
"@quasar/app": "^1.0.0",
"@quasar/quasar-app-extension-dotenv": "^1.0.0",
"@quasar/quasar-app-extension-graphql": "^1.0.0-alpha.1",
"@vue/eslint-config-standard": "^4.0.0",
"babel-eslint": "^10.0.1",
Expand Down
7 changes: 7 additions & 0 deletions client/quasar.extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,12 @@
"server",
"apollo"
]
},
"@quasar/dotenv": {
"env_development": "../.env",
"env_production": "../.env",
"common_root_object": "none",
"create_env_files": false,
"add_env_to_gitignore": false
}
}
2 changes: 1 addition & 1 deletion client/src/boot/graphql.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import fetch from 'node-fetch'
import { setContext } from 'apollo-link-context'

export default ({ Vue, app }) => {
const uri = process.env.API_END_POINT || 'http://localhost:8002/v1/graphql'
const uri = process.env.GRAPHQL_END_POINT
const httpLink = createHttpLink({
uri,
fetch
Expand Down
10 changes: 6 additions & 4 deletions client/src/pages/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ export default {
console.log(`Loaded Publication Authors: ${JSON.stringify(this.publicationAuthors)}`)
},
async fetchData () {
console.log(process.env.POSTGRES_PORT)

This comment has been minimized.

Copy link
@JeffSpies

JeffSpies Mar 23, 2020

Author Contributor

remove

await this.loadReviewStates()
await this.loadPersonsWithFilter()
},
Expand Down Expand Up @@ -399,14 +400,15 @@ export default {
this.publicationCitation = this.getCitationApa(personPublication.publication.csl)
try {
const sanitizedDoi = sanitize(personPublication.publication.doi, { replacement: '_' })
const result = await this.$axios.head(`http://localhost:8000/pdfs/${sanitizedDoi}.pdf`)
const imageHostBase = process.env.IMAGE_HOST_URL
const result = await this.$axios.head(`http://${imageHostBase}/pdfs/${sanitizedDoi}.pdf`)
if (result.status === 200) {
// this.results.title = result.data.title
// this.$set(this.results, 'downloads', result.data.oa_locations[0])
this.unpaywall = `http://localhost:8000/pdfs/${sanitizedDoi}.pdf` // result.data.oa_locations[0].url_for_pdf
const thumbnailResult = await this.$axios.head(`http://localhost:8000/pdfs/${sanitizedDoi}.pdf`)
this.unpaywall = `http://${imageHostBase}/pdfs/${sanitizedDoi}.pdf` // result.data.oa_locations[0].url_for_pdf
const thumbnailResult = await this.$axios.head(`http://${imageHostBase}/pdfs/${sanitizedDoi}.pdf`)
if (thumbnailResult.status === 200) {
this.unpaywallThumbnail = `http://localhost:8000/thumbnails/${sanitizedDoi}.pdf_1.png`
this.unpaywallThumbnail = `http://${imageHostBase}/thumbnails/${sanitizedDoi}.pdf_1.png`
} else {
this.unpaywallThumbnail = '~/assets/Icon-pdf.svg'
}
Expand Down
18 changes: 18 additions & 0 deletions client/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1029,6 +1029,14 @@
resolved "https://registry.yarnpkg.com/@quasar/fastclick/-/fastclick-1.1.4.tgz#21ed3e9a4387dcb43022a08af4ef08a5f1abf159"
integrity sha512-i9wbyV4iT+v4KhtHJynUFhH5LiEPvAEgSnwMqPN4hf/8uRe82nDl5qP5agrp2el1h0HzyBpbvHaW7NB0BPrtvA==

"@quasar/quasar-app-extension-dotenv@^1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@quasar/quasar-app-extension-dotenv/-/quasar-app-extension-dotenv-1.0.0.tgz#7ec2290b7e3e82ef7f93a4c746c08252cadec80c"
integrity sha512-AN7VpItu0x7Lz5CzNhPx0TILSmEMRcKVD2DuYEScwGYAZVxgJb7qfNuaXJ18T87PHNSWbKbTJpCnyOOA8KvrOA==
dependencies:
dotenv "^8.2.0"
fs "^0.0.2"

"@quasar/quasar-app-extension-graphql@^1.0.0-alpha.1":
version "1.0.0-alpha.1"
resolved "https://registry.yarnpkg.com/@quasar/quasar-app-extension-graphql/-/quasar-app-extension-graphql-1.0.0-alpha.1.tgz#7aed03353f9bdf34f3be0cdf809ddaee2759ae74"
Expand Down Expand Up @@ -3195,6 +3203,11 @@ dot-prop@^4.1.1:
dependencies:
is-obj "^1.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==

duplexer@^0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/duplexer/-/duplexer-0.1.1.tgz#ace6ff808c1ce66b57d1ebf97977acb02334cfc1"
Expand Down Expand Up @@ -4027,6 +4040,11 @@ fs.realpath@^1.0.0:
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8=

fs@^0.0.2:
version "0.0.2"
resolved "https://registry.yarnpkg.com/fs/-/fs-0.0.2.tgz#e1f244ef3933c1b2a64bd4799136060d0f5914f8"
integrity sha1-4fJE7zkzwbKmS9R5kTYGDQ9ZFPg=

fsevents@^1.2.7:
version "1.2.9"
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.2.9.tgz#3f5ed66583ccd6f400b5a00db6f7e861363e388f"
Expand Down

0 comments on commit 865ae93

Please sign in to comment.