Skip to content
Snippets Groups Projects
Commit 990b8f30 authored by Reiter, Christoph's avatar Reiter, Christoph :snake:
Browse files

Remove env.js and any hardcoded keycloak configs

We now expect the users to pass the right config to vpu-auth.
Only the API endpoint config remains which we haven't figured out
how to deal with in all cases.
parent c25925bf
No related branches found
No related tags found
No related merge requests found
import environment from 'consts:environment';
var config;
switch(environment) {
case "development":
config = {
apiBaseUrl: 'https://mw-dev.tugraz.at',
keyCloakBaseURL: 'https://auth-dev.tugraz.at/auth',
keyCloakRealm: 'tugraz',
keyCloakClientId: 'auth-dev-mw-frontend',
//sentryDSN: 'http://0405d811e8d746cca2e70f6eff764570@129.27.166.25:9000/2',
};
break;
case "demo":
config = {
apiBaseUrl: 'https://api-demo.tugraz.at',
keyCloakBaseURL: 'https://auth-test.tugraz.at/auth',
keyCloakRealm: 'tugraz',
keyCloakClientId: 'ibib-demo_tugraz_at-IBIB',
};
break;
case "production":
config = {
apiBaseUrl: 'https://api.tugraz.at',
keyCloakBaseURL: 'https://auth.tugraz.at/auth',
keyCloakRealm: 'tugraz',
keyCloakClientId: 'ibib_tugraz_at-IBIB',
};
break;
case "local":
default:
config = {
apiBaseUrl: 'http://127.0.0.1:8000',
keyCloakBaseURL: 'https://auth-dev.tugraz.at/auth',
keyCloakRealm: 'tugraz',
keyCloakClientId: 'auth-dev-mw-frontend-local',
};
}
export default config;
\ No newline at end of file
import * as Sentry from '@sentry/browser';
import env from './env.js';
import environment from 'consts:environment';
let _isInitialized = false;
let _canReportEvent = false;
let sentryDSN = '';
/**
* Initializes error reporting.
*
......@@ -29,7 +30,7 @@ export function init(options) {
sentryOptions['release'] = actual.release;
}
if (!env.sentryDSN) {
if (!sentryDSN) {
if (options.debug)
console.log("No sentry DSN set, sentry disabled");
......@@ -42,7 +43,7 @@ export function init(options) {
return null;
};
} else {
sentryOptions['dsn'] = env.sentryDSN;
sentryOptions['dsn'] = sentryDSN;
_canReportEvent = true;
}
......
......@@ -38,10 +38,6 @@ suite('utils', () => {
assert(utils.getAPiUrl().startsWith("http"));
});
test('setting', () => {
assert(utils.setting('apiBaseUrl').startsWith("http"));
});
test('getAssetURL', () => {
assert.equal(new URL(utils.getAssetURL("foo/bar")).pathname, "/foo/bar");
});
......
import env from './env.js';
import environment from 'consts:environment';
/**
* Parses a link header
......@@ -30,18 +30,25 @@ export const parseLinkHeader = (header) => {
return links;
};
/**
* Reads a setting
*
* @param key
* @returns {*}
*/
export const setting = (key) => {
return env[key];
};
export const getAPiUrl = (path = "") => {
return env.apiBaseUrl + path;
let apiBaseUrl = '';
switch(environment) {
case "development":
apiBaseUrl = 'https://mw-dev.tugraz.at';
break;
case "demo":
apiBaseUrl = 'https://api-demo.tugraz.at';
break;
case "production":
apiBaseUrl = 'https://api.tugraz.at';
break;
case "local":
default:
apiBaseUrl = 'http://127.0.0.1:8000';
}
return apiBaseUrl + path;
};
/**
......
......@@ -80,7 +80,7 @@ class VpuCommonDemo extends ScopedElementsMixin(LitElement) {
getAuthComponentHtml() {
return this.noAuth ? html`` : html`
<div class="container">
<vpu-auth lang="${this.lang}" client-id="${commonUtils.setting('keyCloakClientId')}" load-person></vpu-auth>
<vpu-auth lang="${this.lang}" load-person></vpu-auth>
</div>
`;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment