Commit
+69 -2 +/-2 browse
1 | diff --git a/docker-compose.minio.yml b/docker-compose.minio.yml |
2 | new file mode 100644 |
3 | index 0000000..61f7ac8 |
4 | --- /dev/null |
5 | +++ b/docker-compose.minio.yml |
6 | @@ -0,0 +1,61 @@ |
7 | + # Copy this file to another location and modify as necessary. |
8 | + version: "3" |
9 | + services: |
10 | + minio: |
11 | + image: minio/minio:latest |
12 | + ports: |
13 | + - "9000:9000" |
14 | + volumes: |
15 | + - miniodata:/data |
16 | + environment: |
17 | + # force using given key-secret instead of creating at start |
18 | + - MINIO_ACCESS_KEY=${AWS_ACCESS_KEY_ID} |
19 | + - MINIO_SECRET_KEY=${AWS_SECRET_ACCESS_KEY} |
20 | + command: ["server", "/data"] |
21 | + app: |
22 | + image: jasonwhite0/rudolfs:latest |
23 | + # build: |
24 | + # context: . |
25 | + # dockerfile: Dockerfile |
26 | + ports: |
27 | + - "8081:8080" |
28 | + volumes: |
29 | + - data:/data |
30 | + restart: always |
31 | + environment: |
32 | + - AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} |
33 | + - AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} |
34 | + - AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION} |
35 | + - LFS_ENCRYPTION_KEY=${LFS_ENCRYPTION_KEY} |
36 | + - LFS_S3_BUCKET=${LFS_S3_BUCKET} |
37 | + - LFS_MAX_CACHE_SIZE=${LFS_MAX_CACHE_SIZE} |
38 | + - AWS_S3_ENDPOINT=http://minio:9000 |
39 | + entrypoint: |
40 | + - /tini |
41 | + - -- |
42 | + - /rudolfs |
43 | + - --cache-dir |
44 | + - /data |
45 | + - --key |
46 | + - ${LFS_ENCRYPTION_KEY} |
47 | + - --s3-bucket |
48 | + - ${LFS_S3_BUCKET} |
49 | + - --max-cache-size |
50 | + - ${LFS_MAX_CACHE_SIZE} |
51 | + links: |
52 | + - minio |
53 | + # A real production server should use nginx. How to configure this depends on |
54 | + # your needs. Use your Google-search skills to configure this correctly. |
55 | + # |
56 | + # nginx: |
57 | + # image: nginx:stable |
58 | + # ports: |
59 | + # - 80:80 |
60 | + # - 443:443 |
61 | + # volumes: |
62 | + # - ./nginx.conf:/etc/nginx/nginx.conf |
63 | + # - ./nginx/errors.log:/etc/nginx/errors.log |
64 | + |
65 | + volumes: |
66 | + data: |
67 | + miniodata: |
68 | diff --git a/src/storage/s3.rs b/src/storage/s3.rs |
69 | index b487462..38ff3a0 100644 |
70 | --- a/src/storage/s3.rs |
71 | +++ b/src/storage/s3.rs |
72 | @@ -95,10 +95,16 @@ impl Backend { |
73 | while prefix.ends_with('/') { |
74 | prefix.pop(); |
75 | } |
76 | - |
77 | // `Region::default` will get try to get the region from the environment |
78 | // and fallback to a default if it isn't found. |
79 | - Backend::with_client(S3Client::new(Region::default()), bucket, prefix) |
80 | + let mut region = Region::default(); |
81 | + if let Ok(endpoint) = std::env::var("AWS_S3_ENDPOINT") { |
82 | + region = Region::Custom { |
83 | + name: region.name().to_owned(), |
84 | + endpoint: endpoint, |
85 | + } |
86 | + } |
87 | + Backend::with_client(S3Client::new(region), bucket, prefix) |
88 | } |
89 | } |
90 |