src / config.ts
import { createConfigSchematics } from "@lmstudio/sdk";
export const configSchematics = createConfigSchematics()
.field(
"dbType",
"string",
{
displayName: "Database Type",
subtitle: "Use mysql for XAMPP or postgresql for a PostgreSQL server.",
},
"mysql",
)
.field(
"host",
"string",
{
displayName: "Host",
subtitle: "Database server host or IP address.",
},
"127.0.0.1",
)
.field(
"port",
"numeric",
{
displayName: "Port",
subtitle: "3306 for MySQL, 5432 for PostgreSQL.",
},
3306,
)
.field(
"username",
"string",
{
displayName: "Username",
subtitle: "Database user account.",
},
"root",
)
.field(
"password",
"string",
{
displayName: "Password",
subtitle: "Database password.",
},
"",
)
.field(
"database",
"string",
{
displayName: "Database Name",
subtitle: "Target database to connect to.",
},
"lmstudio_test",
)
.field(
"connectionPool",
"numeric",
{
displayName: "Connection Pool Size",
subtitle: "Maximum number of simultaneous connections.",
slider: { min: 1, max: 25, step: 1 },
},
10,
)
.build();
export type DatabaseConfig = {
dbType: string;
host: string;
port: number;
username: string;
password: string;
database: string;
connectionPool: number;
};