Skip to content

Commit 4bfa4b9

Browse files
authored
chore: normalize env vars (#920)
* chore: normalize env vars * chore: fix missing example values
1 parent 91d3c9f commit 4bfa4b9

File tree

4 files changed

+21
-13
lines changed

4 files changed

+21
-13
lines changed

.env.example

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ VITE_DREAMSYNC_BASE_URL="http://localhost:8888"
9999
EREPUTATION_DATABASE_URL=postgresql://postgres:postgres@localhost:5432/ereputation
100100
EREPUTATION_MAPPING_DB_PATH="/path/to/erep/mapping/db"
101101
VITE_EREPUTATION_BASE_URL=http://localhost:8765
102+
PUBLIC_EREPUTATION_BASE_URL=http://localhost:8765
102103

103104
LOAD_TEST_USER_COUNT=6
104105

@@ -108,9 +109,11 @@ LOKI_URL=http://localhost:3100
108109
LOKI_USERNAME=admin
109110
LOKI_PASSWORD=admin
110111

111-
LOKI_URL=http://146.190.29.56:3100
112-
LOKI_USERNAME=admin
113-
LOKI_PASSWORD=admin
112+
# Control Panel
113+
PUBLIC_CONTROL_PANEL_URL=http://localhost:5173
114+
CONTROL_PANEL_JWT_SECRET=replace-with-a-strong-secret
115+
CONTROL_PANEL_ADMIN_ENAMES_FILE=config/admin-enames.json
116+
VISUALIZER_API_KEY=
114117

115118
DREAMSYNC_JWT_SECRET="secret"
116119
ECURRENCY_JWT_SECRET="secret"

infrastructure/control-panel/.env.example

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,16 @@ LOKI_PASSWORD=admin
77
PUBLIC_REGISTRY_URL=https://registry.staging.metastate.foundation
88
PUBLIC_CONTROL_PANEL_URL=http://localhost:5173
99

10+
# Provisioner
11+
PUBLIC_PROVISIONER_URL=http://localhost:3001
12+
1013
# Notification Trigger (for Notifications tab proxy)
1114
NOTIFICATION_TRIGGER_URL=http://localhost:3998
15+
NOTIFICATION_TRIGGER_PORT=3998
16+
17+
# eReputation / Visualizer
18+
PUBLIC_EREPUTATION_BASE_URL=http://localhost:8765
19+
VISUALIZER_API_KEY=
1220

1321
# W3DS Auth Configuration
1422
CONTROL_PANEL_JWT_SECRET=replace-with-a-strong-secret

infrastructure/control-panel/src/lib/services/notificationService.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
import {
2-
NOTIFICATION_TRIGGER_PORT,
3-
NOTIFICATION_TRIGGER_URL,
4-
PROVISIONER_URL,
5-
PUBLIC_PROVISIONER_URL
6-
} from '$env/static/private';
1+
import { PUBLIC_PROVISIONER_URL } from '$env/static/public';
2+
import { NOTIFICATION_TRIGGER_PORT, NOTIFICATION_TRIGGER_URL } from '$env/static/private';
73

84
export interface NotificationPayload {
95
title: string;
@@ -54,7 +50,7 @@ export async function sendNotification(request: SendNotificationRequest): Promis
5450
}
5551

5652
export async function getDevicesWithTokens(): Promise<{ token: string; eName: string }[]> {
57-
const provisionerUrl = PUBLIC_PROVISIONER_URL || PROVISIONER_URL || 'http://localhost:3001';
53+
const provisionerUrl = PUBLIC_PROVISIONER_URL || 'http://localhost:3001';
5854
try {
5955
const response = await fetch(`${provisionerUrl}/api/devices/list`, {
6056
signal: AbortSignal.timeout(10000)
@@ -71,7 +67,7 @@ export async function getDevicesWithTokens(): Promise<{ token: string; eName: st
7167
export async function getDevicesByEName(
7268
eName: string
7369
): Promise<{ token: string; eName: string }[]> {
74-
const provisionerUrl = PUBLIC_PROVISIONER_URL || PROVISIONER_URL || 'http://localhost:3001';
70+
const provisionerUrl = PUBLIC_PROVISIONER_URL || 'http://localhost:3001';
7571
try {
7672
const response = await fetch(
7773
`${provisionerUrl}/api/devices/by-ename/${encodeURIComponent(eName)}`,

infrastructure/control-panel/src/routes/api/references/+server.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import { json } from '@sveltejs/kit';
22
import type { RequestHandler } from '@sveltejs/kit';
3-
import { EREPUTATION_BASE_URL, VISUALIZER_API_KEY } from '$env/static/private';
3+
import { PUBLIC_EREPUTATION_BASE_URL } from '$env/static/public';
4+
import { VISUALIZER_API_KEY } from '$env/static/private';
45

56
export const GET: RequestHandler = async () => {
6-
const baseUrl = EREPUTATION_BASE_URL || 'http://localhost:8765';
7+
const baseUrl = PUBLIC_EREPUTATION_BASE_URL || 'http://localhost:8765';
78

89
try {
910
const controller = new AbortController();

0 commit comments

Comments
 (0)