Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,22 @@ export const S3RepositoryForm = ({ form }: Props) => {
</FormItem>
)}
/>
<FormField
control={form.control}
name="storageClass"
render={({ field }) => (
<FormItem>
<FormLabel>Storage class (optional)</FormLabel>
<FormControl>
<Input placeholder="STANDARD_IA" {...field} />
</FormControl>
<FormDescription>
Passed to restic as <code>s3.storage-class</code>. Use a class supported by your provider.
</FormDescription>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="accessKeyId"
Expand Down
2 changes: 2 additions & 0 deletions app/client/modules/repositories/tabs/info.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const RepositoryInfoTabContent = ({ repository, initialStats }: Props) =>

const config = repository.config as RepositoryConfig;
const hasLocalPath = Boolean(effectiveLocalPath);
const hasStorageClass = Boolean(config.storageClass);
const hasCaCert = Boolean(config.cacert);
const hasInsecureTlsConfig = config.insecureTls !== undefined;

Expand Down Expand Up @@ -95,6 +96,7 @@ export const RepositoryInfoTabContent = ({ repository, initialStats }: Props) =>
{hasLocalPath && (
<ConfigRow icon={<FolderOpen className="h-4 w-4" />} label="Local Path" value={effectiveLocalPath!} mono />
)}
{hasStorageClass && <ConfigRow icon={<Archive className="h-4 w-4" />} label="Storage Class" value={config.storageClass!} mono />}
<ConfigRow
icon={<Archive className="h-4 w-4" />}
label="Compression Mode"
Expand Down
25 changes: 25 additions & 0 deletions packages/core/src/restic/commands/__tests__/copy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,31 @@ describe("copy command", () => {
expect(getArgs()).not.toContain("--ignore-inode");
});

test("passes storage class option for S3 repositories", async () => {
const { getArgs } = setup();

await Effect.runPromise(
copy(
sourceConfig,
{
backend: "s3",
endpoint: "https://s3.example.com",
bucket: "backups",
accessKeyId: "ak",
secretAccessKey: "sk",
storageClass: "STANDARD_IA",
isExistingRepository: true,
customPassword: "dest-password",
},
{ organizationId: "org-1", tag: "daily" },
mockDeps,
),
);

expect(getArgs()).toContain("-o");
expect(getArgs()).toContain("s3.storage-class=STANDARD_IA");
});

test("passes multiple snapshot IDs after separator", async () => {
const { getArgs } = setup();

Expand Down
4 changes: 4 additions & 0 deletions packages/core/src/restic/helpers/add-common-args.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ export const addCommonArgs = (
args.push("-o", `sftp.args=${env._SFTP_SSH_ARGS}`);
}

if (config?.backend === "s3" && config.storageClass) {
args.push("-o", `s3.storage-class=${config.storageClass}`);
}

if (env.AWS_S3_BUCKET_LOOKUP === "dns") {
args.push("-o", "s3.bucket-lookup=dns");
}
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/restic/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export const s3RepositoryConfigSchema = z
backend: z.literal("s3"),
endpoint: z.string().min(1),
bucket: z.string().min(1),
storageClass: z.string().min(1).optional(),
accessKeyId: z.string().min(1),
secretAccessKey: z.string().min(1),
})
Expand Down