chore(frontend): parametrize server IP

This commit is contained in:
Nicolas Meienberger 2025-12-16 17:38:02 +01:00
parent 5216cc195d
commit c8962bb023
5 changed files with 8 additions and 4 deletions

View file

@ -13,4 +13,4 @@ import type { ClientOptions as ClientOptions2 } from './types.gen';
*/
export type CreateClientConfig<T extends ClientOptions = ClientOptions2> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T>;
export const client = createClient(createConfig<ClientOptions2>({ baseUrl: 'http://192.168.2.42:4096' }));
export const client = createClient(createConfig<ClientOptions2>({ baseUrl: 'http://localhost:4096' }));

View file

@ -1,7 +1,7 @@
// This file is auto-generated by @hey-api/openapi-ts
export type ClientOptions = {
baseUrl: 'http://192.168.2.42:4096' | (string & {});
baseUrl: 'http://localhost:4096' | (string & {});
};
export type RegisterData = {

View file

@ -3,9 +3,11 @@ import "dotenv/config";
const envSchema = type({
NODE_ENV: type.enumerated("development", "production", "test").default("production"),
SERVER_IP: 'string = "localhost"',
}).pipe((s) => ({
__prod__: s.NODE_ENV === "production",
environment: s.NODE_ENV,
serverIp: s.SERVER_IP,
}));
const parseConfig = (env: unknown) => {

View file

@ -19,6 +19,7 @@ import { logger } from "./utils/logger";
import { shutdown } from "./modules/lifecycle/shutdown";
import { REQUIRED_MIGRATIONS } from "./core/constants";
import { validateRequiredMigrations } from "./modules/lifecycle/checkpoint";
import { config } from "./core/config";
export const generalDescriptor = (app: Hono) =>
openAPIRouteHandler(app, {
@ -28,7 +29,7 @@ export const generalDescriptor = (app: Hono) =>
version: "1.0.0",
description: "API for managing volumes",
},
servers: [{ url: "http://192.168.2.42:4096", description: "Development Server" }],
servers: [{ url: `http://${config.serverIp}:4096`, description: "Development Server" }],
},
});

View file

@ -1,7 +1,8 @@
import { defaultPlugins, defineConfig } from "@hey-api/openapi-ts";
import { config } from "./app/server/core/config.js";
export default defineConfig({
input: "http://192.168.2.42:4096/api/v1/openapi.json",
input: `http://${config.serverIp}:4096/api/v1/openapi.json`,
output: {
path: "./app/client/api-client",
format: "biome",