mirror of
https://github.com/nicotsx/ironmount.git
synced 2025-12-10 12:10:51 +01:00
fix: form reset and default values
This commit is contained in:
@@ -13,7 +13,7 @@ export const nfsConfigSchema = type({
|
||||
backend: "'nfs'",
|
||||
server: "string",
|
||||
exportPath: "string",
|
||||
port: type("string.integer.parse").or(type("number")).to("1 <= number <= 65536").default("2049"),
|
||||
port: type("string.integer").or(type("number")).to("1 <= number <= 65536").default(2049),
|
||||
version: "'3' | '4' | '4.1'",
|
||||
});
|
||||
|
||||
@@ -24,8 +24,8 @@ export const smbConfigSchema = type({
|
||||
username: "string",
|
||||
password: "string",
|
||||
vers: type("'1.0' | '2.0' | '2.1' | '3.0'").default("3.0"),
|
||||
domain: "string?",
|
||||
port: type("string.integer.parse").or(type("number")).to("1 <= number <= 65535").default(445),
|
||||
domain: "string | undefined?",
|
||||
port: type("string.integer").or(type("number")).to("1 <= number <= 65535").default(445),
|
||||
});
|
||||
|
||||
export const directoryConfigSchema = type({
|
||||
@@ -36,13 +36,18 @@ export const webdavConfigSchema = type({
|
||||
backend: "'webdav'",
|
||||
server: "string",
|
||||
path: "string",
|
||||
username: "string?",
|
||||
password: "string?",
|
||||
port: type("string.integer.parse").or(type("number")).to("1 <= number <= 65536").default("80"),
|
||||
username: "string | undefined?",
|
||||
password: "string | undefined?",
|
||||
port: type("string.integer").or(type("number")).to("1 <= number <= 65536").default(80),
|
||||
ssl: "boolean?",
|
||||
});
|
||||
|
||||
export const volumeConfigSchema = nfsConfigSchema.or(smbConfigSchema).or(directoryConfigSchema).or(webdavConfigSchema);
|
||||
export const volumeConfigSchemaNoUndefined = nfsConfigSchema
|
||||
.or(smbConfigSchema.omit("domain").and(type({ domain: "string?" })))
|
||||
.or(webdavConfigSchema.omit("username", "password").and(type({ username: "string?", password: "string?" })))
|
||||
.or(directoryConfigSchema);
|
||||
|
||||
export const volumeConfigSchema = nfsConfigSchema.or(smbConfigSchema).or(webdavConfigSchema).or(directoryConfigSchema);
|
||||
|
||||
export type BackendConfig = typeof volumeConfigSchema.infer;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user