Skip to content
Snippets Groups Projects
Unverified 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
KEYCLOAK_ADMIN_PASSWORD=fda
BROKER_CONSUMERS=2
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
ENV METADATA_DB=fda
ENV METADATA_USERNAME=postgres
ENV METADATA_PASSWORD=postgres
ENV GATEWAY_ENDPOINT=https://gateway-service:9095
ENV GATEWAY_ENDPOINT=http://gateway-service:9095
ENV LOG_LEVEL=debug
WORKDIR /app
......
......@@ -41,6 +41,6 @@ eureka:
non-secure-port-enabled: false
secure-port-enabled: true
secure-port: 9095
client.serviceUrl.defaultZone: http://discovery-service:9090/eureka/
client.serviceUrl.defaultZone: http://localhost:9090/eureka/
fda:
ready.path: ./ready
\ No newline at end of file
......@@ -46,6 +46,6 @@ fda:
gateway.endpoint: http://localhost:9095
website: http://localhost:3000
elastic:
endpoint: search-service:9200
endpoint: localhost:9200
username: elastic
password: elastic
\ No newline at end of file
......@@ -24,7 +24,7 @@ FROM openjdk:11-jre-slim as runtime
ENV METADATA_DB=fda
ENV METADATA_USERNAME=root
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 REPOSITORY_NAME="Example Repository"
ENV BASE_URL="http://example.com"
......
......@@ -55,6 +55,6 @@ fda:
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,--
elastic:
endpoint: search-service:9200
endpoint: localhost:9200
username: elastic
password: elastic
\ No newline at end of file
......@@ -49,6 +49,6 @@ fda:
client_id: dbrepo-client
gateway.endpoint: http://localhost:9095
elastic:
endpoint: search-service:9200
endpoint: localhost:9200
username: elastic
password: elastic
\ No newline at end of file
......@@ -47,7 +47,7 @@ fda:
public_key: "${JWT_PUBKEY}"
client_secret: "${DBREPO_CLIENT_SECRET}"
client_id: "${CLIENT_ID}"
gateway.endpoint: https://gateway-service:9095
gateway.endpoint: http://gateway-service:9095
elastic:
endpoint: search-service:9200
username: elastic
......
......@@ -8,7 +8,7 @@ ARG TAG=1.2
ENV NODE_ENV=production
ENV HOST=0.0.0.0
ENV API=https://gateway-service:9095
ENV API=http://gateway-service:9095
WORKDIR /app
......@@ -42,7 +42,6 @@ MAINTAINER Martin Weise <martin.weise@tuwien.ac.at>
EXPOSE 3000
EXPOSE 9100
ENV API=https://gateway-service:9095
ENV BROKER_USERNAME=fda
ENV BROKER_PASSWORD=fda
ENV SANDBOX=false
......
......@@ -325,9 +325,10 @@ export default {
this.resultId = res.data.id
console.debug('view', res.data)
await this.loadDatabase()
} catch (err) {
console.error('Failed to create view', err)
this.$toast.error(err.response.data.message)
} catch (error) {
console.error('Failed to create view', error)
const { statusText } = error.response
this.$toast.error(`Failed to create view: ${statusText}`)
}
this.loadingQuery = false
await Promise.all([this.$refs.queryResults.reExecute(this.resultId), this.$refs.queryResults.reExecuteCount(this.resultId)])
......
......@@ -99,7 +99,7 @@
<script>
import UserToolbar from '@/components/UserToolbar'
import { tokenToRoles, updateUser, toggleUserTheme, getThemeDark } from '@/api/user'
import { tokenToRoles, updateUser, toggleUserTheme, getThemeDark, findUser } from '@/api/user'
export default {
components: {
......@@ -130,9 +130,7 @@ export default {
return this.$store.state.user
},
roles () {
const roles = tokenToRoles(this.token)
console.debug('roles', roles)
return roles
return tokenToRoles(this.token)
},
config () {
if (this.token === null) {
......@@ -187,6 +185,7 @@ export default {
async toggleTheme () {
try {
await toggleUserTheme(this.token, this.user.id, this.theme_dark)
await this.loadUser()
this.$vuetify.theme.dark = this.theme_dark
} catch (error) {
const { message } = error.response
......@@ -195,6 +194,33 @@ export default {
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 () {
if (!this.user) {
return
......
......@@ -35,14 +35,14 @@ eureka:
instance:
hostname: user-service
non-secure-port: 9098
client.serviceUrl.defaultZone: http://discovery-service:9090/eureka/
client.serviceUrl.defaultZone: http://localhost:9090/eureka/
fda:
elastic:
endpoint: localhost:9200
username: elastic
password: elastic
ready.path: ./ready
gateway.endpoint: http://gateway-service:9095
gateway.endpoint: http://localhost:9095
default_role: default-researcher-roles
jwt:
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