fix(templates): use filePath instead of mountPath

This commit is contained in:
Mauricio Siu
2024-08-03 14:59:20 -06:00
parent 95899b7208
commit 4bd6ec2232
5 changed files with 20 additions and 21 deletions

View File

@@ -82,7 +82,7 @@ export const AddVolumes = ({
defaultValues: { defaultValues: {
type: serviceType === "compose" ? "file" : "bind", type: serviceType === "compose" ? "file" : "bind",
hostPath: "", hostPath: "",
mountPath: "", mountPath: serviceType === "compose" ? "/" : "",
}, },
resolver: zodResolver(mySchema), resolver: zodResolver(mySchema),
}); });
@@ -330,20 +330,22 @@ export const AddVolumes = ({
/> />
</> </>
)} )}
<FormField {serviceType !== "compose" && (
control={form.control} <FormField
name="mountPath" control={form.control}
render={({ field }) => ( name="mountPath"
<FormItem> render={({ field }) => (
<FormLabel>Mount Path (In the container)</FormLabel> <FormItem>
<FormControl> <FormLabel>Mount Path (In the container)</FormLabel>
<Input placeholder="Mount Path" {...field} /> <FormControl>
</FormControl> <Input placeholder="Mount Path" {...field} />
</FormControl>
<FormMessage /> <FormMessage />
</FormItem> </FormItem>
)} )}
/> />
)}
</div> </div>
</div> </div>
</form> </form>

View File

@@ -228,7 +228,7 @@ export const composeRouter = createTRPCRouter({
for (const mount of mounts) { for (const mount of mounts) {
await createMount({ await createMount({
filePath: mount.filePath, filePath: mount.filePath,
mountPath: mount.mountPath, mountPath: "",
content: mount.content, content: mount.content,
serviceId: compose.composeId, serviceId: compose.composeId,
serviceType: "compose", serviceType: "compose",

View File

@@ -21,7 +21,7 @@ export function generate(schema: Schema): Template {
const mounts: Template["mounts"] = [ const mounts: Template["mounts"] = [
{ {
mountPath: "./config.toml", filePath: "config.toml",
content: `[app] content: `[app]
address = "0.0.0.0:9000" address = "0.0.0.0:9000"

View File

@@ -23,8 +23,7 @@ export function generate(schema: Schema): Template {
const mounts: Template["mounts"] = [ const mounts: Template["mounts"] = [
{ {
filePath: "clickhouse-config.xml", filePath: "/clickhouse/clickhouse-config.xml",
mountPath: "./clickhouse/clickhouse-config.xml",
content: ` content: `
<clickhouse> <clickhouse>
<logger> <logger>
@@ -46,8 +45,7 @@ export function generate(schema: Schema): Template {
`, `,
}, },
{ {
filePath: "clickhouse-user-config.xml", filePath: "/clickhouse/clickhouse-user-config.xml",
mountPath: "./clickhouse/clickhouse-user-config.xml",
content: ` content: `
<clickhouse> <clickhouse>
<profiles> <profiles>

View File

@@ -14,7 +14,6 @@ export interface Template {
envs: string[]; envs: string[];
mounts?: { mounts?: {
filePath: string; filePath: string;
mountPath: string;
content?: string; content?: string;
}[]; }[];
} }