Skip to content

Commit

Permalink
Allow to disable the creation of a default storage at project creation (
Browse files Browse the repository at this point in the history
#4713)

* Allow to disable the creation of a default storage at project creation

* Address feedback

---------

Co-authored-by: Simon Dumas <[email protected]>
  • Loading branch information
imsdu and Simon Dumas authored Feb 7, 2024
1 parent 67edf52 commit cfa89dd
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 5 deletions.
2 changes: 2 additions & 0 deletions delta/plugins/storage/src/main/resources/storage.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ plugins.storage {
enabled = true
# The priority of the plugin
priority = 1
# Enable the creation of a default storage when a project is created
enable-default-creation = true
# storages configuration
storages {
# Disk storage configuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import pureconfig.generic.semiauto.deriveReader
import pureconfig.{ConfigReader, ConfigSource}

final case class StoragePluginConfig(
enableDefaultCreation: Boolean,
storages: StoragesConfig,
files: FilesConfig,
defaults: Defaults
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,13 +305,10 @@ class StoragePluginModule(priority: Int) extends ModuleDef {
.getOrElse(Set.empty[RemoteStorageServiceDependency])
}

make[StorageScopeInitialization].from {
(storages: Storages, serviceAccount: ServiceAccount, cfg: StoragePluginConfig) =>
new StorageScopeInitialization(storages, serviceAccount, cfg.defaults)
many[ScopeInitialization].addSet { (storages: Storages, serviceAccount: ServiceAccount, cfg: StoragePluginConfig) =>
Option.when(cfg.enableDefaultCreation)(new StorageScopeInitialization(storages, serviceAccount, cfg.defaults)).toSet
}

many[ScopeInitialization].ref[StorageScopeInitialization]

many[ProjectDeletionTask].add { (storages: Storages) => StorageDeletionTask(storages) }

many[MetadataContextValue].addEffect(MetadataContextValue.fromFile("contexts/storages-metadata.json"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,17 @@ class StorageScopeInitialization(

override def entityType: EntityType = Storages.entityType
}

object StorageScopeInitialization {

/**
* Conditionnally create a [[StorageScopeInitialization]]
*/
def when(enabled: Boolean)(
storages: Storages,
serviceAccount: ServiceAccount,
defaults: Defaults
): Option[StorageScopeInitialization] =
Option.when(enabled)(new StorageScopeInitialization(storages, serviceAccount, defaults))

}
4 changes: 4 additions & 0 deletions docs/src/main/paradox/docs/releases/v1.10-release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ using the listing endpoints.

### Storages

#### Disabling default storage

The creation of a default storage at project creation can now be disabled.

#### Undeprecate Storages

Previously deprecated storages can now be undeprecated.
Expand Down

0 comments on commit cfa89dd

Please sign in to comment.