Update env variables, use env variables in vite.config.js
This commit is contained in:
parent
149ba17580
commit
bc8d1b0a21
|
|
@ -1,15 +1,15 @@
|
|||
import path from 'path'
|
||||
import { fileURLToPath, URL } from 'url'
|
||||
|
||||
import { defineConfig } from 'vite'
|
||||
import {defineConfig, loadEnv} from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import vueI18n from '@intlify/vite-plugin-vue-i18n'
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
alias: {
|
||||
'vue-i18n': 'vue-i18n/dist/vue-i18n.runtime.esm-bundler.js'
|
||||
},
|
||||
export default ({mode}) => {
|
||||
process.env = {...process.env, ...loadEnv(mode, process.cwd())};
|
||||
|
||||
return defineConfig({
|
||||
plugins: [
|
||||
vue(),
|
||||
vueI18n({
|
||||
|
|
@ -18,13 +18,16 @@ export default defineConfig({
|
|||
],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': fileURLToPath(new URL('./src', import.meta.url))
|
||||
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
||||
'vue-i18n': 'vue-i18n/dist/vue-i18n.runtime.esm-bundler.js'
|
||||
},
|
||||
},
|
||||
server: {
|
||||
proxy: {
|
||||
'/sso': 'http://localhost:8000',
|
||||
'/api': 'http://localhost:8000',
|
||||
'/sso': process.env.VITE_PROXY_TARGET_BASE,
|
||||
'/api': process.env.VITE_PROXY_TARGET_BASE,
|
||||
'/todo': process.env.VITE_PROXY_TARGET_BASE,
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -454,13 +454,13 @@ if "django_redis.cache.RedisCache" in env("VBV_DJANGO_CACHE_BACKEND", default=""
|
|||
# OAuth/OpenId Connect
|
||||
|
||||
OAUTH = {
|
||||
"client_name": env("OAUTH_CLIENT_NAME", default="lernetz"),
|
||||
"client_id": env("OAUTH_CLIENT_ID", default="iterativ"),
|
||||
"client_secret": env("OAUTH_CLIENT_SECRET", default=""),
|
||||
"access_token_url": env("OAUTH_ACCESS_TOKEN_URL", default="https://sso.test.b.lernetz.host/auth/realms/vbv/protocol/openid-connect/token"),
|
||||
"authorize_url": env("OAUTH_AUTHORIZE_URL", default="https://sso.test.b.lernetz.host/auth/realms/vbv/protocol/openid-connect/auth"),
|
||||
"api_base_url": env("OAUTH_API_BASE_URL", default="https://sso.test.b.lernetz.host/auth/realms/vbv/protocol/openid-connect/"),
|
||||
"local_redirect_uri": env("OAUTH_LOCAL_DIRECT_URI", default="http://localhost:3000/sso/callback/"),
|
||||
"client_name": env("IT_OAUTH_CLIENT_NAME", default="lernetz"),
|
||||
"client_id": env("IT_OAUTH_CLIENT_ID", default="iterativ"),
|
||||
"client_secret": env("IT_OAUTH_CLIENT_SECRET", default=""),
|
||||
"access_token_url": env("IT_OAUTH_ACCESS_TOKEN_URL", default="https://sso.test.b.lernetz.host/auth/realms/vbv/protocol/openid-connect/token"),
|
||||
"authorize_url": env("IT_OAUTH_AUTHORIZE_URL", default="https://sso.test.b.lernetz.host/auth/realms/vbv/protocol/openid-connect/auth"),
|
||||
"api_base_url": env("IT_OAUTH_API_BASE_URL", default="https://sso.test.b.lernetz.host/auth/realms/vbv/protocol/openid-connect/"),
|
||||
"local_redirect_uri": env("IT_OAUTH_LOCAL_DIRECT_URI", default="http://localhost:3000/sso/callback/"),
|
||||
"client_kwargs": {
|
||||
'scope': '',
|
||||
'token_endpoint_auth_method': 'client_secret_post',
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ def authorize(request):
|
|||
user_data["last_name"], user_data["username"])
|
||||
|
||||
dj_login(request, user)
|
||||
# todo: redirect to other page if new user
|
||||
return redirect(f'/{OAUTH_SUCCESS_REDIRECT}?state=success') # to be defined
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue