Skip to content

Commit 08935c7

Browse files
authored
docs(openspec): propose add-s3-path-style-setting (#1169)
Path style addressing for S3 is only switchable with a process-wide JVM property. The proposal adds an optional per-repository setting and keeps the property as the fallback, shipped later as feat(storage). Signed-off-by: TheMeinerLP <github@themeinerlp.dev>
1 parent 5deaccc commit 08935c7

4 files changed

Lines changed: 135 additions & 0 deletions

File tree

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Design
2+
3+
## Context
4+
5+
`S3StorageProviderFactory.create` reads `System.getProperty("reposilite.s3.pathStyleAccessEnabled") == "true"` and, when true, passes an
6+
`S3Configuration` with path style to the client builder. `S3StorageProviderSettings` has no field for it. The reference pages
7+
`references/repositories/storage-providers.md` and `repository-settings.md` document the property.
8+
9+
## Decisions
10+
11+
### D1. A nullable boolean
12+
13+
`pathStyleAccess: Boolean? = null`. Null means "ask the property". This keeps the three states a boolean cannot: forced on, forced off,
14+
and unchanged. A plain `false` default would silently override the property for every existing repository, which breaks the
15+
drop-in rule.
16+
17+
### D2. Resolution in one function
18+
19+
A function `resolvePathStyle(setting: Boolean?, property: String?): Boolean` returns `setting ?: (property == "true")`. The factory
20+
passes the property value in, so the test injects it.
21+
22+
### D3. Same wire format
23+
24+
The field is a plain optional key in the shared configuration. No migration, no rename.
25+
26+
## Open questions
27+
28+
- **Q1.** Whether the form shows a three-state control or a checkbox with a "use server default" note. The proposal assumes a select
29+
with the values "Server default", "On" and "Off".
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Proposal
2+
3+
## Why
4+
5+
Path-style S3 addresses (`https://host/bucket/key`) are needed by most S3-compatible servers such as MinIO. Today they are switched on
6+
only by the JVM property `reposilite.s3.pathStyleAccessEnabled=true`
7+
(`reposilite-backend/.../storage/s3/S3StorageProviderFactory.kt:59`). The property is process-wide, so it cannot differ between two
8+
repositories, it is not visible in the settings form, and an operator must edit `JAVA_OPTS` for what is really a property of one bucket.
9+
10+
## What Changes
11+
12+
- The S3 storage settings gain `pathStyleAccess`, a boolean that defaults to unset, shown in the repository settings with a description.
13+
- When `pathStyleAccess` is set (true or false), it decides for that repository. When it is unset, the JVM property decides, exactly as
14+
today. The property stays valid as the fallback.
15+
- Existing settings files, which lack the field, read as unset, so behaviour is unchanged.
16+
17+
### Out of scope
18+
19+
- Removing or deprecating the JVM property.
20+
- The `reposilite.s3.use-s3-v4-signer` property and other S3 client switches.
21+
- Any other storage provider.
22+
23+
## Capabilities
24+
25+
### New Capabilities
26+
27+
- `s3-path-style-setting`: the per-repository field and its precedence over the property.
28+
29+
## Impact
30+
31+
- **Type and scope.** The change ships under `feat(storage)`. Its commits are `test(storage)`, `feat(storage)` and `docs(storage)`, one
32+
type each. The pull request title is `feat(storage): add a path style setting to the s3 storage`.
33+
- **Breaking marker.** None. The field is additive with an unset default. A configuration without it, and the property alone, behave as
34+
before, so an existing Reposilite installation needs no edit.
35+
- **Order.** Independent of the other open changes.
36+
37+
## Verification
38+
39+
- Unit tests of the precedence with an injected property lookup (no real system property).
40+
- A settings round trip test: a file without the field loads as unset and is written back without changing meaning.
41+
- `openspec validate add-s3-path-style-setting --strict --no-interactive` passes and
42+
`grep -rnP '[\x{2013}\x{2014}]' openspec/changes/add-s3-path-style-setting` prints nothing.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Spec Delta
2+
3+
## Purpose
4+
5+
An operator chooses path-style S3 addressing per repository, and existing deployments that use the JVM property keep working.
6+
7+
## ADDED Requirements
8+
9+
### Requirement: Per-repository path style
10+
11+
The S3 storage settings SHALL accept `pathStyleAccess`. When it is set, the repository SHALL use path-style addressing exactly when it is
12+
true. When it is unset, the repository SHALL use path-style addressing exactly when the JVM property
13+
`reposilite.s3.pathStyleAccessEnabled` is `true`.
14+
15+
#### Scenario: Setting overrides property
16+
17+
- **WHEN** the property is `true` and a repository sets `pathStyleAccess` to false
18+
- **THEN** that repository uses virtual-host addressing and the others keep path style
19+
20+
#### Scenario: Property as fallback
21+
22+
- **WHEN** a repository leaves `pathStyleAccess` unset and the property is `true`
23+
- **THEN** the repository uses path-style addressing
24+
25+
#### Scenario: Setting without property
26+
27+
- **WHEN** the property is absent and a repository sets `pathStyleAccess` to true
28+
- **THEN** the repository uses path-style addressing
29+
30+
### Requirement: Existing configuration is unchanged
31+
32+
A settings document without `pathStyleAccess` SHALL load as unset, and saving it SHALL NOT write a value the operator did not choose.
33+
34+
#### Scenario: Old file
35+
36+
- **WHEN** a configuration written before this change is loaded and saved again
37+
- **THEN** it contains no `pathStyleAccess` value and the repository behaves as before
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Tasks
2+
3+
Each group is one or more commits of one Conventional Commits type each, all with the scope `storage`. Tests are written first and seen to
4+
fail. Every test follows F.I.R.S.T.: the property lookup is injected, no real network, no shared state. Gradle runs go through `heavy`
5+
with `--max-workers=2`, targeted.
6+
7+
## 1. Proposal
8+
9+
- [ ] 1.1 `docs(openspec)`: propose `add-s3-path-style-setting`. Verify: `openspec validate add-s3-path-style-setting --strict
10+
--no-interactive` passes.
11+
12+
## 2. Resolution and field (red, then green)
13+
14+
- [ ] 2.1 `test(storage)`: failing tests of the precedence (set true, set false, unset with property, unset without) and of the settings
15+
round trip for an old file. Verify: they fail.
16+
- [ ] 2.2 `feat(storage)`: the nullable field with its `@Doc`, the resolution function and its use in `S3StorageProviderFactory`. Verify: the
17+
tests of 2.1 pass and the existing S3 tests pass unedited.
18+
19+
## 3. Documentation
20+
21+
- [ ] 3.1 `docs(storage)`: describe the field and the property fallback in `references/repositories/storage-providers.md` and
22+
`repository-settings.md`. Verify: the pages name no new environment variable.
23+
24+
## 4. Open the code pull request
25+
26+
- [ ] 4.1 Open the code pull request `feat(storage): add a path style setting to the s3 storage` against `main` with the body of
27+
`.github/PULL_REQUEST_TEMPLATE.md`. It has no file under `openspec/`, no session link and no co-author.

0 commit comments

Comments
 (0)