mirror of
https://github.com/nicotsx/ironmount.git
synced 2025-12-10 12:10:51 +01:00
add mysql, mariadb, postgresql, sqlite volumes support
This commit is contained in:
@@ -5,6 +5,10 @@ export const BACKEND_TYPES = {
|
||||
smb: "smb",
|
||||
directory: "directory",
|
||||
webdav: "webdav",
|
||||
mariadb: "mariadb",
|
||||
mysql: "mysql",
|
||||
postgres: "postgres",
|
||||
sqlite: "sqlite",
|
||||
} as const;
|
||||
|
||||
export type BackendType = keyof typeof BACKEND_TYPES;
|
||||
@@ -47,7 +51,50 @@ export const webdavConfigSchema = type({
|
||||
ssl: "boolean?",
|
||||
});
|
||||
|
||||
export const volumeConfigSchema = nfsConfigSchema.or(smbConfigSchema).or(webdavConfigSchema).or(directoryConfigSchema);
|
||||
export const mariadbConfigSchema = type({
|
||||
backend: "'mariadb'",
|
||||
host: "string",
|
||||
port: type("string.integer").or(type("number")).to("1 <= number <= 65535").default(3306),
|
||||
username: "string",
|
||||
password: "string",
|
||||
database: "string",
|
||||
dumpOptions: "string[]?",
|
||||
});
|
||||
|
||||
export const mysqlConfigSchema = type({
|
||||
backend: "'mysql'",
|
||||
host: "string",
|
||||
port: type("string.integer").or(type("number")).to("1 <= number <= 65535").default(3306),
|
||||
username: "string",
|
||||
password: "string",
|
||||
database: "string",
|
||||
dumpOptions: "string[]?",
|
||||
});
|
||||
|
||||
export const postgresConfigSchema = type({
|
||||
backend: "'postgres'",
|
||||
host: "string",
|
||||
port: type("string.integer").or(type("number")).to("1 <= number <= 65535").default(5432),
|
||||
username: "string",
|
||||
password: "string",
|
||||
database: "string",
|
||||
dumpFormat: type("'plain' | 'custom' | 'directory'").default("custom"),
|
||||
dumpOptions: "string[]?",
|
||||
});
|
||||
|
||||
export const sqliteConfigSchema = type({
|
||||
backend: "'sqlite'",
|
||||
path: "string",
|
||||
});
|
||||
|
||||
export const volumeConfigSchema = nfsConfigSchema
|
||||
.or(smbConfigSchema)
|
||||
.or(webdavConfigSchema)
|
||||
.or(directoryConfigSchema)
|
||||
.or(mariadbConfigSchema)
|
||||
.or(mysqlConfigSchema)
|
||||
.or(postgresConfigSchema)
|
||||
.or(sqliteConfigSchema);
|
||||
|
||||
export type BackendConfig = typeof volumeConfigSchema.infer;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user