Browse Source

prevent error on catalog missing from config

Signed-off-by: Sean Holcomb <seanholcomb@gmail.com>
Sean Holcomb 2 years ago
parent
commit
0963a63f3a
1 changed files with 7 additions and 5 deletions
  1. 7 5
      pkg/cloud/aws/athenaconfiguration.go

+ 7 - 5
pkg/cloud/aws/athenaconfiguration.go

@@ -12,7 +12,7 @@ type AthenaConfiguration struct {
 	Bucket     string     `json:"bucket"`
 	Region     string     `json:"region"`
 	Database   string     `json:"database"`
-	Catalog    string     `json:"catalog""`
+	Catalog    string     `json:"catalog"`
 	Table      string     `json:"table"`
 	Workgroup  string     `json:"workgroup"`
 	Account    string     `json:"account"`
@@ -149,11 +149,13 @@ func (ac *AthenaConfiguration) UnmarshalJSON(b []byte) error {
 	}
 	ac.Database = database
 
-	catalog, err := config.GetInterfaceValue[string](fmap, "catalog")
-	if err != nil {
-		return fmt.Errorf("AthenaConfiguration: UnmarshalJSON: %s", err.Error())
+	if _, ok := fmap["catalog"]; ok {
+		catalog, err := config.GetInterfaceValue[string](fmap, "catalog")
+		if err == nil {
+			return fmt.Errorf("AthenaConfiguration: UnmarshalJSON: %s", err.Error())
+		}
+		ac.Catalog = catalog
 	}
-	ac.Catalog = catalog
 
 	table, err := config.GetInterfaceValue[string](fmap, "table")
 	if err != nil {