Skip to content

Commit

Permalink
chore: update env variables
Browse files Browse the repository at this point in the history
Signed-off-by: Akiff Manji <akiff.manji@quartech.com>
  • Loading branch information
amanji committed Oct 21, 2024
1 parent 2a94893 commit f3729c7
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 12 deletions.
2 changes: 2 additions & 0 deletions scripts/.env-example
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,9 @@ TENANT_UI_PORT=5101
# which traction api are we using?
# naming convention follows what is used by the tenant ui config
SERVER_TRACTION_URL=http://localhost:8032
SERVER_LOKI_URL=ws://localhost:3100
FRONTEND_TENANT_PROXY_URL=http://localhost:8032
FRONTEND_LOG_STREAM_URL=ws://localhost:5101/logStream
IMAGE_BUILDTIME=
IMAGE_TAG=scripts_tenant-ui:latest
IMAGE_VERSION=latest
Expand Down
2 changes: 2 additions & 0 deletions scripts/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ services:
condition: service_started
environment:
- SERVER_TRACTION_URL=${SERVER_TRACTION_URL}
- SERVER_LOKI_URL=${SERVER_LOKI_URL}
- FRONTEND_TENANT_PROXY_URL=${FRONTEND_TENANT_PROXY_URL}
- FRONTEND_LOG_STREAM_URL=${FRONTEND_LOG_STREAM_URL}
- IMAGE_BUILDTIME=${IMAGE_BUILDTIME}
- IMAGE_TAG=${IMAGE_TAG}
- IMAGE_VERSION=${IMAGE_VERSION}
Expand Down
7 changes: 4 additions & 3 deletions scripts/manage
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ generate_traction_ascii_art() {

# Global variable to hold Docker Compose command
compose_cmd=""
compose_files_opt="-f docker-compose.logs.yml -f docker-compose.yml"

# Function to determine the correct Docker Compose command
get_docker_compose_command() {
if command -v "docker" > /dev/null && docker compose version > /dev/null 2>&1; then
compose_cmd="docker compose"
compose_cmd="docker compose $compose_files_opt"
elif command -v docker-compose > /dev/null 2>&1; then
compose_cmd="docker-compose"
compose_cmd="docker-compose $compose_files_opt"
else
echo "Error: Neither 'docker compose' nor 'docker-compose' is installed." >&2
exit 1
Expand Down Expand Up @@ -65,7 +66,7 @@ build_docker_images() {
fi

built_services="traction-acapy-image-builder tenant-ui tenant-proxy endorser-api endorser-api-1"
pulled_services="ngrok-traction-agent traction-db endorser-db endorser-db-1 maildev endorser-agent endorser-agent-1"
pulled_services="loki promtail grafana ngrok-traction-agent traction-db endorser-db endorser-db-1 maildev endorser-agent endorser-agent-1"
$compose_cmd build $built_services --no-cache --parallel
$compose_cmd pull $pulled_services
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"frontend": {
"tenantProxyPath": "FRONTEND_TENANT_PROXY_URL",
"logStreamUrl": "FRONTEND_LOG_STREAM_URL",
"showInnkeeperReservationPassword": "FRONTEND_INNKEEPER_SHOW_RESERVATION_PASSWORD",
"showInnkeeperAdminLogin": "FRONTEND_INNKEEPER_SHOW_ADMIN",
"showWritableComponents": "FRONTEND_TENANT_SHOW_WRITABLE_COMPONENTS",
Expand Down
5 changes: 3 additions & 2 deletions services/tenant-ui/config/default.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"frontend": {
"tenantProxyPath": "http://localhost:8032",
"logStreamUrl": "ws://localhost:5101/logStream",
"apiPath": "api/",
"basePath": "/",
"showDeveloper": true,
Expand Down Expand Up @@ -53,8 +54,8 @@
"logLevel": "http",
"port": "8080",
"staticFiles": "../../frontend/dist",
"tractionUrl": "http://localhost:5100",
"lokiUrl": "ws://localhost:3100",
"tractionUrl": "http://host.docker.internal:8032",
"lokiUrl": "ws://host.docker.internal:3100",
"oidc": {
"jwksUri": "https://dev.loginproxy.gov.bc.ca/auth/realms/digitaltrust-citz/protocol/openid-connect/certs",
"realm": "digitaltrust-citz",
Expand Down
2 changes: 1 addition & 1 deletion services/tenant-ui/frontend/src/store/logStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const useLogStore = defineStore('log', () => {
}
if (!logStream.value) {
logStream.value = new WebSocket(
`${config.server.lokiUrl}?token=${token}`
`${config.frontend.logStreamUrl}?token=${token}`
);
logStream.value.onopen = () => {
logStreamState.value = LogStreamState.OPEN;
Expand Down
6 changes: 6 additions & 0 deletions services/tenant-ui/frontend/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ export default defineConfig({
},
server: {
proxy: {
'/logStream': {
target: 'ws://localhost:8080',
ws: true,
changeOrigin: true,
rewrite: (path) => path.replace(/^\/logStream/, ''),
},
'/api': proxyObject,
'/config': proxyObject,
},
Expand Down
12 changes: 6 additions & 6 deletions services/tenant-ui/src/components/innkeeper.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import axios from "axios";
import config from "config";
const TRACURL: string = config.get("server.tractionUrl");
const INN_USER = config.get("server.innkeeper.user");
const INN_PW = config.get("server.innkeeper.key");
const TRACTION_URL: string = config.get("server.tractionUrl");
const INNKEEPER_USER = config.get("server.innkeeper.user");
const INNKEEPER_KEY = config.get("server.innkeeper.key");

/**
* @function login
* Use the configured Inkeeper Admin key to get the token
* @returns {string} The inkeeper token
*/
export const login = async () => {
const loginUrl = `${TRACURL}/multitenancy/tenant/${INN_USER}/token`;
const payload = { wallet_key: INN_PW };
const loginUrl = `${TRACTION_URL}/multitenancy/tenant/${INNKEEPER_USER}/token`;
const payload = { wallet_key: INNKEEPER_KEY };
const res = await axios({
method: "post",
url: loginUrl,
Expand All @@ -29,7 +29,7 @@ export const login = async () => {
export const createReservation = async (req: any, token: string) => {
try {
const auth = `Bearer ${token}`;
const reservationUrl = `${TRACURL}/innkeeper/reservations`;
const reservationUrl = `${TRACTION_URL}/innkeeper/reservations`;
const payload = req.body;

const res = await axios({
Expand Down

0 comments on commit f3729c7

Please sign in to comment.