refactor(report): azure and aws writer (#1190)

This commit is contained in:
Kota Kanbe
2021-03-04 07:42:38 +09:00
committed by GitHub
parent 1ec31d7be9
commit 2a8ee4b22b
4 changed files with 73 additions and 67 deletions

View File

@@ -1,5 +1,11 @@
package config
import (
"os"
"golang.org/x/xerrors"
)
// AzureConf is azure config
type AzureConf struct {
// Azure account name to use. AZURE_STORAGE_ACCOUNT environment variable is used if not specified
@@ -16,9 +22,18 @@ type AzureConf struct {
// Validate configuration
func (c *AzureConf) Validate() (errs []error) {
// TODO
if !c.Enabled {
return
}
if c.AccountName == "" {
c.AccountName = os.Getenv("AZURE_STORAGE_ACCOUNT")
}
if c.AccountKey == "" {
c.AccountKey = os.Getenv("AZURE_STORAGE_ACCESS_KEY")
}
if c.ContainerName == "" {
errs = append(errs, xerrors.Errorf("Azure storage container name is required"))
}
return
}