update admin with new url config approach

This commit is contained in:
einhorn_b 2024-01-04 19:18:28 +01:00
parent 5d70c5e063
commit 1258d43d38
8 changed files with 29 additions and 18 deletions

View File

@ -131,7 +131,7 @@ Each component (frontend, admin, backend and database) has its own `.env` file.
Each component has a `.env.dist` file. This file contains all environment variables used by the component and can be used as pattern. If you want to use a local `.env`, copy the `.env.dist` and adjust the variables accordingly.
Each component has a `.env.template` file. These files are very important on deploy.
Each component has a `.env.template` file. These files are very important on deploy. They use COMMUNITY_HOST instead of different urls for different modules because in deploy using nginx is expected for routing incoming request to the correct module
There is one `.env.dist` in the `deployment/bare_metal/` folder. This `.env.dist` contains all variables used by the components, e.g. unites all `.env.dist` from the components. On deploy, we copy this `.env.dist` to `.env` and set all variables in this new file. The deploy script loads this variables and provides them by the `.env.templates` of each component, creating an `.env` for each component (see in `deployment/bare_metal/start.sh` the `envsubst`).

View File

@ -1,4 +1,6 @@
GRAPHQL_URI=http://localhost:4000/graphql
WALLET_AUTH_URL=http://localhost/authenticate?token={token}
WALLET_URL=http://localhost/login
GRAPHQL_URL=http://localhost:4000
GRAPHQL_PATH=/graphql
WALLET_URL=http://localhost
WALLET_AUTH_PATH=/authenticate?token={token}
WALLET_LOGIN_PATH=/login
DEBUG_DISABLE_AUTH=false

View File

@ -1,6 +1,7 @@
CONFIG_VERSION=$ADMIN_CONFIG_VERSION
GRAPHQL_URI=$GRAPHQL_URI
WALLET_AUTH_URL=$WALLET_AUTH_URL
WALLET_URL=$WALLET_URL
DEBUG_DISABLE_AUTH=false
COMMUNITY_HOST=$COMMUNITY_HOST
WALLET_AUTH_PATH=$WALLET_AUTH_PATH
WALLET_LOGIN_PATH=$WALLET_LOGIN_PATH
GRAPHQL_PATH=$GRAPHQL_PATH
DEBUG_DISABLE_AUTH=false

View File

@ -7,7 +7,7 @@ const pkg = require('../../package')
const constants = {
CONFIG_VERSION: {
DEFAULT: 'DEFAULT',
EXPECTED: 'v1.2022-03-18',
EXPECTED: 'v2.2024-01-04',
CURRENT: '',
},
}
@ -26,10 +26,18 @@ const environment = {
PRODUCTION: process.env.NODE_ENV === 'production' || false,
}
const COMMUNITY_HOST = process.env.COMMUNITY_HOST || undefined
const URL_PROTOCOL = process.env.URL_PROTOCOL || 'http'
const COMMUNITY_URL =
COMMUNITY_HOST && URL_PROTOCOL ? URL_PROTOCOL + '://' + COMMUNITY_HOST : undefined
const WALLET_URL = process.env.WALLET_URL || COMMUNITY_URL || 'http://localhost'
const endpoints = {
GRAPHQL_URI: process.env.GRAPHQL_URI || 'http://localhost:4000/graphql',
WALLET_AUTH_URL: process.env.WALLET_AUTH_URL || 'http://localhost/authenticate?token={token}',
WALLET_URL: process.env.WALLET_URL || 'http://localhost/login',
GRAPHQL_URL:
(process.env.GRAPHQL_URL || COMMUNITY_URL || 'http://localhost:4000') +
process.env.GRAPHQL_PATH || '/graphql',
WALLET_AUTH_URL: WALLET_URL + (process.env.WALLET_AUTH_PATH || '/authenticate?token={token}'),
WALLET_LOGIN_URL: WALLET_URL + (process.env.WALLET_LOGIN_PATH || '/login'),
}
const debug = {

View File

@ -16,7 +16,7 @@ const authLink = new ApolloLink((operation, forward) => {
return forward(operation).map((response) => {
if (response.errors && response.errors[0].message === '403.13 - Client certificate revoked') {
store.dispatch('logout', null)
window.location.assign(CONFIG.WALLET_URL)
window.location.assign(CONFIG.WALLET_LOGIN_URL)
return response
}
const newToken = operation.getContext().response.headers.get('token')

View File

@ -1,7 +1,7 @@
# Need to adjust!
COMMUNITY_NAME="Your community name"
COMMUNITY_DESCRIPTION="Short Description from your Community."
COMMUNITY_URL=gddhost.tld
COMMUNITY_HOST=gddhost.tld
COMMUNITY_SUPPORT_MAIL=support@supportmail.com
# Need to adjust by updates
@ -9,7 +9,7 @@ COMMUNITY_SUPPORT_MAIL=support@supportmail.com
DATABASE_CONFIG_VERSION=v1.2022-03-18
BACKEND_CONFIG_VERSION=v17.2023-07-03
FRONTEND_CONFIG_VERSION=v4.2022-12-20
ADMIN_CONFIG_VERSION=v1.2022-03-18
ADMIN_CONFIG_VERSION=v2.2024-01-04
FEDERATION_CONFIG_VERSION=v1.2023-01-09
FEDERATION_DHT_CONFIG_VERSION=v3.2023-04-26
@ -40,10 +40,10 @@ WEBHOOK_GITHUB_BRANCH=master
# frontend and admin paths, usually don't need changes
# used in nginx config and for links in emails
WALLET_PATH=/login
COMMUNITY_REGISTER_PATH=/register
COMMUNITY_REDEEM_PATH=/redeem/{code}
COMMUNITY_REDEEM_CONTRIBUTION_PATH=/redeem/CL-{code}
WALLET_LOGIN_PATH=/login
WALLET_AUTH_PATH=/authenticate?token={token}
EMAIL_LINK_VERIFICATION=/checkEmail/{optin}{code}
EMAIL_LINK_SETPASSWORD=/reset-password/{optin}

View File

@ -1,5 +1,5 @@
server {
server_name $COMMUNITY_URL;
server_name $COMMUNITY_HOST;
listen 80;
listen [::]:80;

View File

@ -1,6 +1,6 @@
server {
server_name _;
server_name $COMMUNITY_HOST;
listen 80;
listen [::]:80;