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

View File

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

View File

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

View File

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

View File

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