Closed asiffermann closed 7 years ago
Here is the configuration we have today:
"Storage": {
"Stores": {
"Youpi1": {
"Provider": "FileSystem",
"Parameters": {
"Path": "Youpi1"
}
},
"Youpi2": {
"Provider": "FileSystem",
"Parameters": {
"Path": "AnotherPath",
"Access": "Public"
}
},
"Youpi3": {
"Provider": "FileSystem",
"Parameters": {
"Path": "Youpi3"
}
},
"Youpi4": {
"Provider": "Azure",
"Parameters": {
"ConnectionString": "",
"Container": "Youpi4"
}
},
"Youpa": {
"Provider": "Azure",
"Parameters": {
"ConnectionString": "",
"Container": "Youpa"
}
}
}
}
And here is the configuration I'd like to have:
"Storage": {
"Providers": {
"Azure": {
"ConnectionStrings": {
"DefaultConnection": "",
"AnotherConnection": ""
},
"DefaultConnectionStringName": "DefaultConnection"
},
"FileSystem": {
"RootPath": ""
}
},
"Stores": {
"Youpi1": {
"Provider": "FileSystem"
},
"Youpi2": {
"Provider": "FileSystem",
"AccessLevel": "Public",
"FolderName": "AnotherPath"
},
"Youpi3": {
"Provider": "FileSystem",
"FolderNameFormat": "AnotherPath-{0}"
},
"Youpi4": {
"Provider": "Azure"
},
"Youpa": {
"Provider": "Azure",
"AccessLevel": "Confidential",
"FolderNameFormat": "Youpa-{0}",
"ConnectionStringName": "AnotherConnection"
}
"Youpa2": {
"Provider": "Azure",
"ConnectionString": ""
}
}
}
Global:
Provider
Container
and Path
merged into one single configuration key: Folder
. If not specified, the name of the Store is taken.FolderNameFormat
can be used instead to initialize a Store with params (for example one store per user)AccessLevel
: used to define the Azure container public access level, or if the Store may be exposed by the FileSystem server. Available values are:
Public
: map to BlobContainerPublicAccessType.Container
, can list store and read filesConfidential
: map to BlobContainerPublicAccessType.Blob
, can read filesPrivate
(default): map to BlobContainerPublicAccessType.Off
, no accessFileSystem:
RootPath
can now be set from configuration at provider-level tooAzure:
ConnectionStrings
are defined at provider-level, and we referenced them by their names. Plus, there will be an override to AddAzureStorage
which will take a configuration section to pass the default ConnectionStrings section of the appsettings.json if we want to share some with other components.DefaultConnectionStringName
at provider-level will be applied to every container which does not override the settingsConnectionStringName
to reference a connection string put in the global list or a ConnectionString
to set a very specific one to this storeWhat do you think @sandorfr? 😃
I like it very much, Just wondering how it would impact IStore<TOptions>
Be carefull with you azure sample as container names have limitations on their names. Provisionning and AccessLevel feature is ❤️
After talking with @annayafi, I changed a little bit some options, introduced Named Providers, and extract the ScopedStores configurations in another key:
"Storage": {
"Providers": {
"FirstAzure": {
"Type": "Azure",
"ConnectionString": "DefaultEndpointsProtocol=https;AccountName=default;AccountKey=<key>;EndpointSuffix=core.windows.net"
},
"AnotherAzure": {
"Type": "Azure",
"ConnectionStringName": "ConnectionStringFromAppSettings"
},
"FirstFileSystem": {
"Type": "FileSystem",
"RootPath": "C:/First"
},
"AnotherFileSystem": {
"Type": "FileSystem",
"RootPath": "D:/Another"
}
},
"Stores": {
"Youpi1": {
"ProviderName": "FirstFileSystem"
},
"Youpi2": {
"ProviderName": "FirstFileSystem",
"AccessLevel": "Public",
"FolderName": "AnotherPath"
},
"Youpi4": {
"ProviderName": "FirstAzure",
"AccessLevel": "Private"
},
"Youpa2": {
"ProviderType": "Azure",
"ConnectionString": "DefaultEndpointsProtocol=https;AccountName=excpetionaccount;AccountKey=<key>;EndpointSuffix=core.windows.net"
}
},
"ScopedStores": {
"Youpi3": {
"ProviderName": "AnotherFileSystem",
"FolderNameFormat": "AnotherPath-{0}"
},
"Youpa": {
"ProviderName": "AnotherAzure",
"AccessLevel": "Confidential",
"FolderNameFormat": "Youpa-{0}"
}
}
}
Global:
ProviderName
ProviderType
and provider's configuration keysContainer
and Path
merged into one single configuration key: FolderName
. If not specified, the name of the Store is taken.AccessLevel
: used to define the Azure container public access level, or if the Store may be exposed by the FileSystem server. Available values are:
Public
: map to BlobContainerPublicAccessType.Container
, can list store and read filesConfidential
: map to BlobContainerPublicAccessType.Blob
, can read filesPrivate
(default): map to BlobContainerPublicAccessType.Off
, no accessScopeStores:
FolderNameFormat
is mandatory to initialize a Store with params (for example one store per user)FileSystem:
RootPath
can now be set from configuration at provider-levelAzure:
ConnectionString
is now defined at provider-levelConnectionStringName
if we call an override to AddAzureStorage
which take a configuration section to pass the default ConnectionStrings section of the appsettings.jsonConnectionStringName
or ConnectionString
What do you think @sandorfr and @arnaudauroux? 😃
@arnaudauroux and @annayafi are a little bit shy, but they found it cool! 😄
@asiffermann We are talking about a configuration file enhancement ;) This is not gonna save kittens ! :P
this conversation is getting too weird for me !
Moi je pense que c'est vital pour les chatons !
@sandorfr and @arnaudauroux, it would be great if you could review the PR 😃
There is only two things left:
Disclaimer: This PR introduces several breaking changes!
ConnectionStringName
parameter mapping: you can use the override ofAddStorage
that takes aIConfigurationRoot
as parameter, and the connection strings will be resolved by nameNew Configuration
Global:
ProviderName
ProviderType
and provider's configuration keysContainer
andPath
merged into one single configuration key:FolderName
. If not specified, the name of the Store is taken.AccessLevel
: used to define the Azure container public access level, or if the Store may be exposed by the FileSystem server. Available values are:Public
: map toBlobContainerPublicAccessType.Container
, can list store and read filesConfidential
: map toBlobContainerPublicAccessType.Blob
, can read filesPrivate
(default): map toBlobContainerPublicAccessType.Off
, no accessScopeStores:
FolderNameFormat
is mandatory to initialize a Store with params (for example one store per user)FileSystem:
RootPath
can now be set from configuration at provider-levelAzure:
ConnectionString
is now defined at provider-levelConnectionStringName
if we call an override toAddAzureStorage
which take a configuration section to pass the default ConnectionStrings section of the appsettings.jsonConnectionStringName
orConnectionString