mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-06-04 05:10:40 +00:00
Add support for Azure storage as a publishing backend
This adds a new configuration setting: AzurePublishEndpoints, similar to the existing S3PublishEndpoints and SwiftPublishEndpoints. For each endpoint, the following has to be defined: - accountName - accountKey - container - prefix Azure tests require the following environment variables to be set: - AZURE_STORAGE_ACCOUNT - AZURE_STORAGE_ACCESS_KEY With either of these not set, Azure-specific tests are skipped.
This commit is contained in:
@@ -30,6 +30,7 @@ type ConfigStructure struct { // nolint: maligned
|
||||
FileSystemPublishRoots map[string]FileSystemPublishRoot `json:"FileSystemPublishEndpoints"`
|
||||
S3PublishRoots map[string]S3PublishRoot `json:"S3PublishEndpoints"`
|
||||
SwiftPublishRoots map[string]SwiftPublishRoot `json:"SwiftPublishEndpoints"`
|
||||
AzurePublishRoots map[string]AzurePublishRoot `json:"AzurePublishEndpoints"`
|
||||
}
|
||||
|
||||
// FileSystemPublishRoot describes single filesystem publishing entry point
|
||||
@@ -72,6 +73,14 @@ type SwiftPublishRoot struct {
|
||||
Container string `json:"container"`
|
||||
}
|
||||
|
||||
// AzurePublishRoot describes single Azure publishing entry point
|
||||
type AzurePublishRoot struct {
|
||||
AccountName string `json:"accountName"`
|
||||
AccountKey string `json:"accountKey"`
|
||||
Container string `json:"container"`
|
||||
Prefix string `json:"prefix"`
|
||||
}
|
||||
|
||||
// Config is configuration for aptly, shared by all modules
|
||||
var Config = ConfigStructure{
|
||||
RootDir: filepath.Join(os.Getenv("HOME"), ".aptly"),
|
||||
@@ -93,6 +102,7 @@ var Config = ConfigStructure{
|
||||
FileSystemPublishRoots: map[string]FileSystemPublishRoot{},
|
||||
S3PublishRoots: map[string]S3PublishRoot{},
|
||||
SwiftPublishRoots: map[string]SwiftPublishRoot{},
|
||||
AzurePublishRoots: map[string]AzurePublishRoot{},
|
||||
}
|
||||
|
||||
// LoadConfig loads configuration from json file
|
||||
|
||||
@@ -44,6 +44,9 @@ func (s *ConfigSuite) TestSaveConfig(c *C) {
|
||||
s.config.SwiftPublishRoots = map[string]SwiftPublishRoot{"test": {
|
||||
Container: "repo"}}
|
||||
|
||||
s.config.AzurePublishRoots = map[string]AzurePublishRoot{"test": {
|
||||
Container: "repo"}}
|
||||
|
||||
err := SaveConfig(configname, &s.config)
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
@@ -114,6 +117,14 @@ func (s *ConfigSuite) TestSaveConfig(c *C) {
|
||||
" \"prefix\": \"\",\n"+
|
||||
" \"container\": \"repo\"\n"+
|
||||
" }\n"+
|
||||
" },\n"+
|
||||
" \"AzurePublishEndpoints\": {\n"+
|
||||
" \"test\": {\n"+
|
||||
" \"accountName\": \"\",\n"+
|
||||
" \"accountKey\": \"\",\n"+
|
||||
" \"container\": \"repo\",\n"+
|
||||
" \"prefix\": \"\"\n"+
|
||||
" }\n"+
|
||||
" }\n"+
|
||||
"}")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user