-
Notifications
You must be signed in to change notification settings - Fork 13
Enhanced configuration #44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ons from StorageFactory
|
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:
FileSystem:
Azure:
What do you think @sandorfr? 😃 |
|
I like it very much, Just wondering how it would impact |
|
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:
ScopeStores:
FileSystem:
Azure:
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!
ConnectionStringNameparameter mapping: you can use the override ofAddStoragethat takes aIConfigurationRootas parameter, and the connection strings will be resolved by nameNew Configuration
{ "ConnectionStrings": { "ConnectionStringFromAppSettings": "DefaultEndpointsProtocol=https;AccountName=<YourAccount>;AccountKey=<YourKey>;EndpointSuffix=core.windows.net" }, "Storage": { "Providers": { "FirstAzure": { "Type": "Azure", "ConnectionString": "DefaultEndpointsProtocol=https;AccountName=<YourAccount>;AccountKey=<YourKey>;EndpointSuffix=core.windows.net" }, "AnotherAzure": { "Type": "Azure", "ConnectionStringName": "ConnectionStringFromAppSettings" }, "FirstFileSystem": { "Type": "FileSystem" }, "AnotherFileSystem": { "Type": "FileSystem", "RootPath": "../FileVault2" } }, "Stores": { "Store1": { "ProviderName": "FirstFileSystem" }, "Store2": { "ProviderName": "FirstFileSystem", "AccessLevel": "Public", "FolderName": "AnotherPath" }, "Store3": { "ProviderName": "FirstAzure", "AccessLevel": "Private" }, "Store4": { "ProviderType": "Azure", "ConnectionString": "DefaultEndpointsProtocol=https;AccountName=<YourAccount>;AccountKey=<YourKey>;EndpointSuffix=core.windows.net" }, "Store5": { "ProviderName": "AnotherAzure" }, "Store6": { "ProviderType": "Azure", "ConnectionStringName": "ConnectionStringFromAppSettings" } }, "ScopedStores": { "ScopedStore1": { "ProviderName": "AnotherFileSystem", "FolderNameFormat": "AnotherPath-{0}" }, "ScopedStore2": { "ProviderName": "AnotherAzure", "AccessLevel": "Confidential", "FolderNameFormat": "AnotherPath-{0}" } } } }Global:
ProviderNameProviderTypeand provider's configuration keysContainerandPathmerged 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:
FolderNameFormatis mandatory to initialize a Store with params (for example one store per user)FileSystem:
RootPathcan now be set from configuration at provider-levelAzure:
ConnectionStringis now defined at provider-levelConnectionStringNameif we call an override toAddAzureStoragewhich take a configuration section to pass the default ConnectionStrings section of the appsettings.jsonConnectionStringNameorConnectionString