2018-11-08 01:09:33 +01:00
|
|
|
interface IUriConfig {
|
2019-03-11 19:16:39 +01:00
|
|
|
auth?: string
|
|
|
|
|
content?: string
|
|
|
|
|
site?: string
|
|
|
|
|
services?: string
|
2018-11-08 01:09:33 +01:00
|
|
|
}
|
|
|
|
|
|
2018-11-11 19:27:04 +01:00
|
|
|
const uri: IUriConfig = {}
|
2018-11-08 01:09:33 +01:00
|
|
|
|
|
|
|
|
const addProp = (obj: {}, propName: string, value: string) => {
|
2019-03-11 19:16:39 +01:00
|
|
|
Object.defineProperty(obj, propName, {
|
|
|
|
|
enumerable: false,
|
|
|
|
|
get: () => {
|
|
|
|
|
return '//' + window.location.host + value
|
|
|
|
|
}
|
|
|
|
|
})
|
2018-11-11 19:27:04 +01:00
|
|
|
}
|
2018-11-08 01:09:33 +01:00
|
|
|
|
2018-11-11 19:27:04 +01:00
|
|
|
addProp(uri, 'auth', '/auth/')
|
|
|
|
|
addProp(uri, 'content', '/api/content/')
|
2018-11-12 18:08:06 +01:00
|
|
|
addProp(uri, 'site', process.env.MONGODB_HOST)
|
2018-11-11 19:27:04 +01:00
|
|
|
addProp(uri, 'services', '/api/')
|
2018-11-08 01:09:33 +01:00
|
|
|
|
|
|
|
|
const config = {
|
2019-03-11 19:16:39 +01:00
|
|
|
claimsNamespace: '//toucan/claims',
|
|
|
|
|
uri,
|
|
|
|
|
auth: {
|
|
|
|
|
accessTokenKey: 'AUTH-LOCAL',
|
|
|
|
|
externalProviderKey: 'AUTH-EXTERNAL'
|
|
|
|
|
},
|
|
|
|
|
uopt: 'UOPT',
|
|
|
|
|
xsrf: {
|
|
|
|
|
cookieName: 'XSRF-TOKEN',
|
|
|
|
|
headerName: 'X-XSRF-TOKEN'
|
|
|
|
|
}
|
2018-11-11 19:27:04 +01:00
|
|
|
}
|
2018-11-08 01:09:33 +01:00
|
|
|
|
2018-11-11 19:27:04 +01:00
|
|
|
export default config
|