Compare commits

..

2 Commits

Author SHA1 Message Date
waltem01
c107fcff44 optional import in API_STRING 2024-04-09 09:42:10 +02:00
waltem01
30ea6032c9 env var always defined 2024-04-09 09:41:55 +02:00
2 changed files with 7 additions and 5 deletions

View File

@ -26,11 +26,11 @@ export interface MatrixCell {
// in the project-wide .env file. This is intentional. The optional- // in the project-wide .env file. This is intentional. The optional-
// chaining operator will catch these errors. // chaining operator will catch these errors.
export function initializeMatrix(): Matrix { export function initializeMatrix(): Matrix {
const led_width = Number(env?.PUBLIC_LED_WIDTH ?? '64'); const led_width = Number(env.PUBLIC_LED_WIDTH ?? '64');
const led_height = Number(env?.PUBLIC_LED_HEIGHT ?? '64'); const led_height = Number(env.PUBLIC_LED_HEIGHT ?? '64');
const led_chain = Number(env?.PUBLIC_LED_CHAIN ?? '1'); const led_chain = Number(env.PUBLIC_LED_CHAIN ?? '1');
const led_parallel = Number(env?.PUBLIC_LED_PARALLEL ?? '1'); const led_parallel = Number(env.PUBLIC_LED_PARALLEL ?? '1');
return { return {
width: led_width * led_parallel, width: led_width * led_parallel,

View File

@ -1,5 +1,7 @@
import { API_SERVER_IP, API_SERVER_PORT } from '$env/static/private'; import * as env from '$env/static/private';
export function buildAPIStr(endpoint: string) { export function buildAPIStr(endpoint: string) {
const API_SERVER_IP = env.API_SERVER_IP;
const API_SERVER_PORT = env.API_SERVER_PORT;
return `http://${API_SERVER_IP ?? 'localhost'}:${API_SERVER_PORT ?? '8080'}/${endpoint}`; return `http://${API_SERVER_IP ?? 'localhost'}:${API_SERVER_PORT ?? '8080'}/${endpoint}`;
} }