You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CLAUDE.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,7 @@ docker compose up # Starts MinIO at localhost:9000; app at localhost:8080
26
26
27
27
S3 Manager is a stateless Go web app for managing S3-compatible storage (AWS S3, MinIO, etc.). There is no database; S3 is the sole source of truth.
28
28
29
-
**Backend** (`main.go` + `internal/app/s3manager/`): Gorilla mux routes requests to handler factory functions. Each handler receives its dependencies (S3 client, templates, config flags) via closure, not global state. The `MultiS3Manager` wraps multiple S3 instances; instance selection happens via a `{instance}` URL prefix, enabling concurrent multi-instance sessions.
29
+
**Backend** (`main.go` + `internal/app/s3manager/`): Gorilla mux routes requests to handler factory functions. Each handler receives its dependencies (S3 client, templates, `Options`) via closure, not global state. `S3Instances` is the ordered, immutable list of configured S3 instances; instance selection happens via a `{instance}` URL prefix, enabling concurrent multi-instance sessions. `WithInstance` resolves that prefix and hands the matching client to a single-instance handler, so most handlers never see the instance list.
30
30
31
31
**Frontend** (`web/`): Server-rendered HTML using three Go templates (`layout.html.tmpl`, `buckets.html.tmpl`, `bucket.html.tmpl`) styled with [BeerCSS](https://www.beercss.com/) 5.0.3 (Material Design 3). No JS framework and no jQuery — plain `fetch` plus BeerCSS's `ui()` helper for dialogs, menus and snackbars. `layout.html.tmpl` owns the page shell, the shared `appbar-actions` template (instance switcher, light/dark toggle) and the shared `toast`/`request` helpers; each page template renders its own `<header>` and `<main>`.
32
32
@@ -40,7 +40,7 @@ Static assets and templates are embedded into the binary via `//go:embed`, and B
40
40
HTTP request
41
41
→ Gorilla mux (main.go)
42
42
→ Handler factory (e.g. HandleBucketView)
43
-
→ MultiS3Manager.GetS3Instance(instanceName)
43
+
→ S3Instances.Get(instanceName) (via WithInstance for non-view handlers)
44
44
→ S3 interface call (minio-go/v7 under the hood)
45
45
→ Template render or JSON response
46
46
```
@@ -54,8 +54,8 @@ HTTP request
54
54
55
55
### Configuration
56
56
57
-
Instances are configured via numbered environment variables (`1_ENDPOINT`, `1_ACCESS_KEY_ID`, …) or a single unnamed set for backward compatibility. Viper is used to read all config. `ROOT_URL` supports reverse-proxy deployments with a path prefix.
57
+
Instances are configured via numbered environment variables (`1_ENDPOINT`, `1_ACCESS_KEY_ID`, …) or a single unnamed set for backward compatibility. Viper is used to read all config. `ROOT_URL` supports reverse-proxy deployments with a path prefix. The feature flags the handlers care about are bundled into a single `s3manager.Options` value that `main.go` fills in and passes down.
58
58
59
59
## Testing
60
60
61
-
Tests live alongside source files. Each handler file has a corresponding `_test.go`. The `S3` mock (`mocks/s3.go`) is generated — regenerate with `go generate ./...` if the interface changes. Tests use `github.com/matryer/is` for assertions.
61
+
Tests live alongside source files: each handler file has a corresponding `_test.go` in package `s3manager_test`, and the few tests of unexported helpers use `*_internal_test.go` in package `s3manager`. The `S3` mock (`mocks/s3.go`) is generated — regenerate with `go generate ./...` if the interface changes. Tests use `github.com/matryer/is` for assertions.
Copy file name to clipboardExpand all lines: README.md
+53-12Lines changed: 53 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,28 +9,71 @@ A Web GUI written in Go to manage S3 buckets from any provider.
9
9
10
10
## Features
11
11
12
-
- List all buckets in your account
13
-
- Create a new bucket
14
-
- List all objects in a bucket
15
-
- Upload new objects to a bucket
16
-
- Download object from a bucket
12
+
- Manage several S3 accounts side by side and switch between them
13
+
- List, create and delete buckets
14
+
- View and edit a bucket's policy
15
+
- List a bucket's objects with search, sorting and pagination
16
+
- Upload single objects or whole folders to a bucket
17
+
- Download an object, or several selected ones as a ZIP archive
17
18
- Open an object in the browser (click its name or use the `Open` action)
18
-
- Delete an object in a bucket
19
+
- Delete a single object or several selected ones
20
+
- Create a time-limited download link for an object
21
+
- Check whether an object is publicly accessible and copy its public link
19
22
- Show object metadata (including user metadata) and object versions
20
23
21
24
## Usage
22
25
23
26
### Configuration
24
27
25
-
The application can be configured with the following environment variables:
28
+
The application is configured with environment variables.
26
29
27
-
-`ENDPOINT`: The endpoint of your S3 server (defaults to `s3.amazonaws.com`)
30
+
#### S3 instances
31
+
32
+
Every S3 account the app should manage is configured with a numbered set of
33
+
variables, starting at `1_`. The app stops looking at the first number that has
34
+
no `NAME` or no `ENDPOINT`, so the numbering must not have gaps. Each instance
35
+
appears in the app under its `NAME` and is reachable under `/<NAME>/buckets`
36
+
(or `/<NUMBER>/buckets`), so pick names that work in a URL:
37
+
38
+
```shell
39
+
1_NAME=production
40
+
1_ENDPOINT=s3.amazonaws.com
41
+
1_ACCESS_KEY_ID=XXX
42
+
1_SECRET_ACCESS_KEY=xxx
43
+
44
+
2_NAME=backups
45
+
2_ENDPOINT=minio.example.com:9000
46
+
2_ACCESS_KEY_ID=YYY
47
+
2_SECRET_ACCESS_KEY=yyy
48
+
```
49
+
50
+
A single instance may also be configured without a number (it is then named
51
+
`Default`), which is how earlier versions of the app were configured:
52
+
53
+
```shell
54
+
ENDPOINT=s3.amazonaws.com
55
+
ACCESS_KEY_ID=XXX
56
+
SECRET_ACCESS_KEY=xxx
57
+
```
58
+
59
+
The variables below are read per instance, either with a `N_` prefix or, for a
60
+
single unnamed instance, without one. At least one instance must be configured.
61
+
62
+
-`NAME`: The name the instance is shown and addressed under (required in the numbered form; a single unnamed instance is called `Default`)
63
+
-`ENDPOINT`: The endpoint of your S3 server (required, for example `s3.amazonaws.com`)
28
64
-`REGION`: The region of your S3 server (defaults to `""`)
29
65
-`ACCESS_KEY_ID`: Your S3 access key ID (required) (works only if `USE_IAM` is `false`)
30
66
-`SECRET_ACCESS_KEY`: Your S3 secret access key (required) (works only if `USE_IAM` is `false`)
67
+
-`USE_IAM`: Use IAM role instead of key pair (defaults to `false`)
68
+
-`IAM_ENDPOINT`: Endpoint for IAM role retrieving (Can be blank for AWS)
31
69
-`USE_SSL`: Whether your S3 server uses SSL or not (defaults to `true`)
32
70
-`SKIP_SSL_VERIFICATION`: Whether the HTTP client should skip SSL verification (defaults to `false`)
33
71
-`SIGNATURE_TYPE`: The signature type to be used (defaults to `V4`; valid values are `V2, V4, V4Streaming, Anonymous`)
72
+
73
+
#### Application
74
+
75
+
These variables apply to the whole app and are never prefixed:
76
+
34
77
-`PORT`: The port the app should listen on (defaults to `8080`)
35
78
-`ALLOW_DELETE`: Enable buttons to delete objects (defaults to `true`)
36
79
-`FORCE_DOWNLOAD`: Add response headers for object downloading instead of opening in a new tab (defaults to `true`; only affects the `Download` action, not `Open`)
@@ -39,8 +82,6 @@ The application can be configured with the following environment variables:
39
82
-`SHOW_METADATA`: Show the object metadata action and enable the metadata endpoint (defaults to `true`)
40
83
-`TZ`: IANA timezone used when displaying object Last Modified times (defaults to UTC; for example `Europe/Berlin`)
41
84
-`BUCKET_NAME`: Restrict the buckets view to a single named bucket (defaults to unset, showing all buckets)
42
-
-`USE_IAM`: Use IAM role instead of key pair (defaults to `false`)
43
-
-`IAM_ENDPOINT`: Endpoint for IAM role retrieving (Can be blank for AWS)
44
85
-`SSE_TYPE`: Specified server side encryption (defaults blank) Valid values can be `SSE`, `KMS`, `SSE-C` all others values don't enable the SSE
45
86
-`SSE_KEY`: The key needed for SSE method (only for `KMS` and `SSE-C`)
46
87
-`TIMEOUT`: The read and write timeout in seconds (default to `600` - 10 minutes)
@@ -53,7 +94,7 @@ The application can be configured with the following environment variables:
53
94
54
95
### Run Container image
55
96
56
-
1. Run `docker run -p 8080:8080 -e 'ACCESS_KEY_ID=XXX' -e 'SECRET_ACCESS_KEY=xxx' cloudlena/s3manager`
97
+
1. Run `docker run -p 8080:8080 -e 'ENDPOINT=s3.amazonaws.com' -e 'ACCESS_KEY_ID=XXX' -e 'SECRET_ACCESS_KEY=xxx' cloudlena/s3manager`
57
98
58
99
### Deploy to Kubernetes
59
100
@@ -100,7 +141,7 @@ The image is available on [Docker Hub](https://hub.docker.com/r/cloudlena/s3mana
100
141
101
142
### Run Locally for Testing
102
143
103
-
There is an example [docker-compose.yml](https://github.com/cloudlena/s3manager/blob/main/docker-compose.yml) file that spins up an S3 service and the S3 Manager. You can try it by issuing the following command:
144
+
There is an example [docker-compose.yml](https://github.com/cloudlena/s3manager/blob/main/docker-compose.yml) file that spins up two S3 services and the S3 Manager configured for both of them. You can try it by issuing the following command:
0 commit comments