chore(frontend): parametrize server IP
This commit is contained in:
parent
fe5810b1a7
commit
feb6353e21
5 changed files with 8 additions and 4 deletions
|
|
@ -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 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' }));
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
// This file is auto-generated by @hey-api/openapi-ts
|
// This file is auto-generated by @hey-api/openapi-ts
|
||||||
|
|
||||||
export type ClientOptions = {
|
export type ClientOptions = {
|
||||||
baseUrl: 'http://192.168.2.42:4096' | (string & {});
|
baseUrl: 'http://localhost:4096' | (string & {});
|
||||||
};
|
};
|
||||||
|
|
||||||
export type RegisterData = {
|
export type RegisterData = {
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,11 @@ import "dotenv/config";
|
||||||
|
|
||||||
const envSchema = type({
|
const envSchema = type({
|
||||||
NODE_ENV: type.enumerated("development", "production", "test").default("production"),
|
NODE_ENV: type.enumerated("development", "production", "test").default("production"),
|
||||||
|
SERVER_IP: 'string = "localhost"',
|
||||||
}).pipe((s) => ({
|
}).pipe((s) => ({
|
||||||
__prod__: s.NODE_ENV === "production",
|
__prod__: s.NODE_ENV === "production",
|
||||||
environment: s.NODE_ENV,
|
environment: s.NODE_ENV,
|
||||||
|
serverIp: s.SERVER_IP,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const parseConfig = (env: unknown) => {
|
const parseConfig = (env: unknown) => {
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ import { logger } from "./utils/logger";
|
||||||
import { shutdown } from "./modules/lifecycle/shutdown";
|
import { shutdown } from "./modules/lifecycle/shutdown";
|
||||||
import { REQUIRED_MIGRATIONS } from "./core/constants";
|
import { REQUIRED_MIGRATIONS } from "./core/constants";
|
||||||
import { validateRequiredMigrations } from "./modules/lifecycle/checkpoint";
|
import { validateRequiredMigrations } from "./modules/lifecycle/checkpoint";
|
||||||
|
import { config } from "./core/config";
|
||||||
|
|
||||||
export const generalDescriptor = (app: Hono) =>
|
export const generalDescriptor = (app: Hono) =>
|
||||||
openAPIRouteHandler(app, {
|
openAPIRouteHandler(app, {
|
||||||
|
|
@ -28,7 +29,7 @@ export const generalDescriptor = (app: Hono) =>
|
||||||
version: "1.0.0",
|
version: "1.0.0",
|
||||||
description: "API for managing volumes",
|
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" }],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
import { defaultPlugins, defineConfig } from "@hey-api/openapi-ts";
|
import { defaultPlugins, defineConfig } from "@hey-api/openapi-ts";
|
||||||
|
import { config } from "./app/server/core/config.js";
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
input: "http://192.168.2.42:4096/api/v1/openapi.json",
|
input: `http://${config.serverIp}:4096/api/v1/openapi.json`,
|
||||||
output: {
|
output: {
|
||||||
path: "./app/client/api-client",
|
path: "./app/client/api-client",
|
||||||
format: "biome",
|
format: "biome",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue