mirror of
https://github.com/DorkSquadRR/DorkNet.git
synced 2026-10-25 15:08:47 -07:00
feat: Make S3 bucket names configurable via environment variables
This commit is contained in:
@@ -62,8 +62,8 @@ public interface IObjectStorage
|
||||
|
||||
public static class Buckets
|
||||
{
|
||||
public const string Content = "dorknet-content";
|
||||
public const string Saves = "dorknet-saves";
|
||||
public static string Content { get; set; } = "dorknet-content";
|
||||
public static string Saves { get; set; } = "dorknet-saves";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -157,6 +157,13 @@ public class ObjectStorageService : IObjectStorage, IDisposable
|
||||
{
|
||||
_log = log;
|
||||
_diskFallbackRoot = Path.Combine(AppContext.BaseDirectory, "data", "object-fallback");
|
||||
// Bucket names are env-overridable so a new game generation can point at
|
||||
// fresh buckets (e.g. dorknet2023-*) without a code change. Applied here
|
||||
// (before the disk/S3 branch) so the disk fallback paths use them too.
|
||||
if (config["S3:ContentBucket"] is { Length: > 0 } contentBucket) Buckets.Content = contentBucket;
|
||||
if (config["S3:SavesBucket"] is { Length: > 0 } savesBucket) Buckets.Saves = savesBucket;
|
||||
_log.LogInformation(
|
||||
"[storage] buckets content={Content} saves={Saves}", Buckets.Content, Buckets.Saves);
|
||||
|
||||
// Provider switch: env-driven. The Garage one-click service in
|
||||
// Coolify exposes its endpoint on http://garage:3900 and supplies
|
||||
|
||||
@@ -8,6 +8,8 @@ x-dorknet-service-env: &dorknet-service-env
|
||||
S3__AccessKey: ${DORKNET_S3_ACCESS_KEY:?Set DORKNET_S3_ACCESS_KEY in Dokploy}
|
||||
S3__SecretKey: ${DORKNET_S3_SECRET_KEY:?Set DORKNET_S3_SECRET_KEY in Dokploy}
|
||||
S3__Region: ${DORKNET_S3_REGION:-garage}
|
||||
S3__ContentBucket: ${DORKNET_S3_CONTENT_BUCKET:-dorknet-content}
|
||||
S3__SavesBucket: ${DORKNET_S3_SAVES_BUCKET:-dorknet-saves}
|
||||
Photon__AppId: ${Photon__AppId:?Set Photon__AppId in Dokploy}
|
||||
Photon__VoiceAppId: ${Photon__VoiceAppId:-}
|
||||
Photon__CloudRegion: ${Photon__CloudRegion:-eu}
|
||||
|
||||
Reference in New Issue
Block a user