diff --git a/graphql/schema/types/config.graphql b/graphql/schema/types/config.graphql index a92bcc168..bbbb63373 100644 --- a/graphql/schema/types/config.graphql +++ b/graphql/schema/types/config.graphql @@ -8,7 +8,8 @@ input SetupInput { generatedLocation: String! "Empty to indicate default" cacheLocation: String! - "Empty to indicate database storage for blobs" + storeBlobsInDatabase: Boolean! + "Empty to indicate default - only applicable if storeBlobsInDatabase is false" blobsLocation: String! } diff --git a/internal/manager/manager.go b/internal/manager/manager.go index caad6e347..0b1c50abe 100644 --- a/internal/manager/manager.go +++ b/internal/manager/manager.go @@ -100,7 +100,9 @@ type SetupInput struct { GeneratedLocation string `json:"generatedLocation"` // Empty to indicate default CacheLocation string `json:"cacheLocation"` - // Empty to indicate database storage for blobs + + StoreBlobsInDatabase bool `json:"storeBlobsInDatabase"` + // Empty to indicate default BlobsLocation string `json:"blobsLocation"` } @@ -596,6 +598,10 @@ func setSetupDefaults(input *SetupInput) { if input.DatabaseFile == "" { input.DatabaseFile = filepath.Join(configDir, "stash-go.sqlite") } + + if input.BlobsLocation == "" { + input.BlobsLocation = filepath.Join(configDir, "blobs") + } } func (s *Manager) Setup(ctx context.Context, input SetupInput) error { @@ -648,20 +654,20 @@ func (s *Manager) Setup(ctx context.Context, input SetupInput) error { s.Config.Set(config.Cache, input.CacheLocation) } - // if blobs path was provided then use filesystem based blob storage - if input.BlobsLocation != "" { + if input.StoreBlobsInDatabase { + s.Config.Set(config.BlobsStorage, config.BlobStorageTypeDatabase) + } else { if !c.HasOverride(config.BlobsPath) { if exists, _ := fsutil.DirExists(input.BlobsLocation); !exists { if err := os.MkdirAll(input.BlobsLocation, 0755); err != nil { return fmt.Errorf("error creating blobs directory: %v", err) } } + + s.Config.Set(config.BlobsPath, input.BlobsLocation) } - s.Config.Set(config.BlobsPath, input.BlobsLocation) s.Config.Set(config.BlobsStorage, config.BlobStorageTypeFilesystem) - } else { - s.Config.Set(config.BlobsStorage, config.BlobStorageTypeDatabase) } // set the configuration diff --git a/ui/v2.5/src/components/Setup/Setup.tsx b/ui/v2.5/src/components/Setup/Setup.tsx index f4f825322..7774b2452 100644 --- a/ui/v2.5/src/components/Setup/Setup.tsx +++ b/ui/v2.5/src/components/Setup/Setup.tsx @@ -40,7 +40,8 @@ export const Setup: React.FC = () => { const [databaseFile, setDatabaseFile] = useState(""); const [generatedLocation, setGeneratedLocation] = useState(""); const [cacheLocation, setCacheLocation] = useState(""); - const [blobsLocation, setBlobsLocation] = useState("blobs"); + const [storeBlobsInDatabase, setStoreBlobsInDatabase] = useState(false); + const [blobsLocation, setBlobsLocation] = useState(""); const [loading, setLoading] = useState(false); const [setupError, setSetupError] = useState(""); @@ -393,27 +394,43 @@ export const Setup: React.FC = () => { }} />
-
- {blobsLocation !== ""
+ {storeBlobsInDatabase
+ ? intl.formatMessage({
+ id: "setup.confirm.blobs_use_database",
+ })
+ : blobsLocation !== ""
? blobsLocation
: intl.formatMessage({
id: "setup.confirm.default_blobs_location",
diff --git a/ui/v2.5/src/locales/en-GB.json b/ui/v2.5/src/locales/en-GB.json
index 6775e71ca..b0efd4170 100644
--- a/ui/v2.5/src/locales/en-GB.json
+++ b/ui/v2.5/src/locales/en-GB.json
@@ -1149,10 +1149,11 @@
"confirm": {
"almost_ready": "We're almost ready to complete the configuration. Please confirm the following settings. You can click back to change anything incorrect. If everything looks good, click Confirm to create your system.",
"blobs_directory": "Binary data directory",
+ "blobs_use_database": "