Skip to content
Snippets Groups Projects
Verified Commit ceb71275 authored by Martin Weise's avatar Martin Weise
Browse files

Added gateway endpoint

parent b831f531
No related branches found
No related tags found
2 merge requests!163Relase 1.3.0,!155Added readme to authentication service and added eureka service
Showing with 46 additions and 19 deletions
...@@ -15,3 +15,4 @@ KEYCLOAK_ADMIN=fda ...@@ -15,3 +15,4 @@ KEYCLOAK_ADMIN=fda
KEYCLOAK_ADMIN_PASSWORD=fda KEYCLOAK_ADMIN_PASSWORD=fda
BROKER_CONSUMERS=2 BROKER_CONSUMERS=2
WEBSITE=http://example.com WEBSITE=http://example.com
GATEWAY_ENDPOINT=http://gateway-service:9095
\ No newline at end of file
...@@ -19,7 +19,7 @@ FROM openjdk:11-jre-slim as runtime ...@@ -19,7 +19,7 @@ FROM openjdk:11-jre-slim as runtime
ENV METADATA_DB=fda ENV METADATA_DB=fda
ENV METADATA_USERNAME=postgres ENV METADATA_USERNAME=postgres
ENV METADATA_PASSWORD=postgres ENV METADATA_PASSWORD=postgres
ENV GATEWAY_ENDPOINT=https://gateway-service:9095 ENV GATEWAY_ENDPOINT=http://gateway-service:9095
ENV LOG_LEVEL=debug ENV LOG_LEVEL=debug
WORKDIR /app WORKDIR /app
......
...@@ -41,6 +41,6 @@ eureka: ...@@ -41,6 +41,6 @@ eureka:
non-secure-port-enabled: false non-secure-port-enabled: false
secure-port-enabled: true secure-port-enabled: true
secure-port: 9095 secure-port: 9095
client.serviceUrl.defaultZone: http://discovery-service:9090/eureka/ client.serviceUrl.defaultZone: http://localhost:9090/eureka/
fda: fda:
ready.path: ./ready ready.path: ./ready
\ No newline at end of file
...@@ -46,6 +46,6 @@ fda: ...@@ -46,6 +46,6 @@ fda:
gateway.endpoint: http://localhost:9095 gateway.endpoint: http://localhost:9095
website: http://localhost:3000 website: http://localhost:3000
elastic: elastic:
endpoint: search-service:9200 endpoint: localhost:9200
username: elastic username: elastic
password: elastic password: elastic
\ No newline at end of file
...@@ -24,7 +24,7 @@ FROM openjdk:11-jre-slim as runtime ...@@ -24,7 +24,7 @@ FROM openjdk:11-jre-slim as runtime
ENV METADATA_DB=fda ENV METADATA_DB=fda
ENV METADATA_USERNAME=root ENV METADATA_USERNAME=root
ENV METADATA_PASSWORD=dbrepo ENV METADATA_PASSWORD=dbrepo
ENV GATEWAY_ENDPOINT=https://gateway-service:9095 ENV GATEWAY_ENDPOINT=http://gateway-service:9095
ENV PID_BASE="http://example.com/pid/" ENV PID_BASE="http://example.com/pid/"
ENV REPOSITORY_NAME="Example Repository" ENV REPOSITORY_NAME="Example Repository"
ENV BASE_URL="http://example.com" ENV BASE_URL="http://example.com"
......
...@@ -55,6 +55,6 @@ fda: ...@@ -55,6 +55,6 @@ fda:
consumers: 2 consumers: 2
unsupported: \*,AVG,BIT_AND,BIT_OR,BIT_XOR,COUNT,COUNTDISTINCT,GROUP_CONCAT,JSON_ARRAYAGG,JSON_OBJECTAGG,MAX,MIN,STD,STDDEV,STDDEV_POP,STDDEV_SAMP,SUM,VARIANCE,VAR_POP,VAR_SAMP,-- unsupported: \*,AVG,BIT_AND,BIT_OR,BIT_XOR,COUNT,COUNTDISTINCT,GROUP_CONCAT,JSON_ARRAYAGG,JSON_OBJECTAGG,MAX,MIN,STD,STDDEV,STDDEV_POP,STDDEV_SAMP,SUM,VARIANCE,VAR_POP,VAR_SAMP,--
elastic: elastic:
endpoint: search-service:9200 endpoint: localhost:9200
username: elastic username: elastic
password: elastic password: elastic
\ No newline at end of file
...@@ -49,6 +49,6 @@ fda: ...@@ -49,6 +49,6 @@ fda:
client_id: dbrepo-client client_id: dbrepo-client
gateway.endpoint: http://localhost:9095 gateway.endpoint: http://localhost:9095
elastic: elastic:
endpoint: search-service:9200 endpoint: localhost:9200
username: elastic username: elastic
password: elastic password: elastic
\ No newline at end of file
...@@ -47,7 +47,7 @@ fda: ...@@ -47,7 +47,7 @@ fda:
public_key: "${JWT_PUBKEY}" public_key: "${JWT_PUBKEY}"
client_secret: "${DBREPO_CLIENT_SECRET}" client_secret: "${DBREPO_CLIENT_SECRET}"
client_id: "${CLIENT_ID}" client_id: "${CLIENT_ID}"
gateway.endpoint: https://gateway-service:9095 gateway.endpoint: http://gateway-service:9095
elastic: elastic:
endpoint: search-service:9200 endpoint: search-service:9200
username: elastic username: elastic
......
...@@ -8,7 +8,7 @@ ARG TAG=1.2 ...@@ -8,7 +8,7 @@ ARG TAG=1.2
ENV NODE_ENV=production ENV NODE_ENV=production
ENV HOST=0.0.0.0 ENV HOST=0.0.0.0
ENV API=https://gateway-service:9095 ENV API=http://gateway-service:9095
WORKDIR /app WORKDIR /app
...@@ -42,7 +42,6 @@ MAINTAINER Martin Weise <martin.weise@tuwien.ac.at> ...@@ -42,7 +42,6 @@ MAINTAINER Martin Weise <martin.weise@tuwien.ac.at>
EXPOSE 3000 EXPOSE 3000
EXPOSE 9100 EXPOSE 9100
ENV API=https://gateway-service:9095
ENV BROKER_USERNAME=fda ENV BROKER_USERNAME=fda
ENV BROKER_PASSWORD=fda ENV BROKER_PASSWORD=fda
ENV SANDBOX=false ENV SANDBOX=false
......
...@@ -325,9 +325,10 @@ export default { ...@@ -325,9 +325,10 @@ export default {
this.resultId = res.data.id this.resultId = res.data.id
console.debug('view', res.data) console.debug('view', res.data)
await this.loadDatabase() await this.loadDatabase()
} catch (err) { } catch (error) {
console.error('Failed to create view', err) console.error('Failed to create view', error)
this.$toast.error(err.response.data.message) const { statusText } = error.response
this.$toast.error(`Failed to create view: ${statusText}`)
} }
this.loadingQuery = false this.loadingQuery = false
await Promise.all([this.$refs.queryResults.reExecute(this.resultId), this.$refs.queryResults.reExecuteCount(this.resultId)]) await Promise.all([this.$refs.queryResults.reExecute(this.resultId), this.$refs.queryResults.reExecuteCount(this.resultId)])
......
...@@ -99,7 +99,7 @@ ...@@ -99,7 +99,7 @@
<script> <script>
import UserToolbar from '@/components/UserToolbar' import UserToolbar from '@/components/UserToolbar'
import { tokenToRoles, updateUser, toggleUserTheme, getThemeDark } from '@/api/user' import { tokenToRoles, updateUser, toggleUserTheme, getThemeDark, findUser } from '@/api/user'
export default { export default {
components: { components: {
...@@ -130,9 +130,7 @@ export default { ...@@ -130,9 +130,7 @@ export default {
return this.$store.state.user return this.$store.state.user
}, },
roles () { roles () {
const roles = tokenToRoles(this.token) return tokenToRoles(this.token)
console.debug('roles', roles)
return roles
}, },
config () { config () {
if (this.token === null) { if (this.token === null) {
...@@ -187,6 +185,7 @@ export default { ...@@ -187,6 +185,7 @@ export default {
async toggleTheme () { async toggleTheme () {
try { try {
await toggleUserTheme(this.token, this.user.id, this.theme_dark) await toggleUserTheme(this.token, this.user.id, this.theme_dark)
await this.loadUser()
this.$vuetify.theme.dark = this.theme_dark this.$vuetify.theme.dark = this.theme_dark
} catch (error) { } catch (error) {
const { message } = error.response const { message } = error.response
...@@ -195,6 +194,33 @@ export default { ...@@ -195,6 +194,33 @@ export default {
this.error = true this.error = true
} }
}, },
async loadUser () {
if (!this.token) {
return
}
try {
const res = await findUser(this.token)
const user = res.data
console.debug('user', user)
this.$store.commit('SET_USER', user)
const roles = tokenToRoles(this.token)
this.$store.commit('SET_ROLES', roles)
this.$vuetify.theme.dark = getThemeDark(user)
this.loading = false
} catch (error) {
console.error('Failed to load user', error)
const { status } = error.response
if (status === 401) {
console.error('Token expired', error)
this.$toast.warning('Login has expired')
this.logout()
} else {
console.error('user data', error)
this.$toast.error('Failed to load user')
this.error = true
}
}
},
init () { init () {
if (!this.user) { if (!this.user) {
return return
......
...@@ -35,14 +35,14 @@ eureka: ...@@ -35,14 +35,14 @@ eureka:
instance: instance:
hostname: user-service hostname: user-service
non-secure-port: 9098 non-secure-port: 9098
client.serviceUrl.defaultZone: http://discovery-service:9090/eureka/ client.serviceUrl.defaultZone: http://localhost:9090/eureka/
fda: fda:
elastic: elastic:
endpoint: localhost:9200 endpoint: localhost:9200
username: elastic username: elastic
password: elastic password: elastic
ready.path: ./ready ready.path: ./ready
gateway.endpoint: http://gateway-service:9095 gateway.endpoint: http://localhost:9095
default_role: default-researcher-roles default_role: default-researcher-roles
jwt: jwt:
issuer: https://localhost:8443/realms/dbrepo issuer: https://localhost:8443/realms/dbrepo
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment