Skip to content

Commit

Permalink
Merge pull request #302 from najeal/config-split
Browse files Browse the repository at this point in the history
Config split
  • Loading branch information
cam-schultz authored Jun 12, 2024
2 parents 7e18908 + 9ef07ef commit 3413a0e
Show file tree
Hide file tree
Showing 11 changed files with 529 additions and 430 deletions.
20 changes: 20 additions & 0 deletions config/api_config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package config

import (
"fmt"
"net/url"
)

// API configuration containing the base URL and query parameters
type APIConfig struct {
BaseURL string `mapstructure:"base-url" json:"base-url"`
QueryParams map[string]string `mapstructure:"query-parameters" json:"query-parameters"`
HTTPHeaders map[string]string `mapstructure:"http-headers" json:"http-headers"`
}

func (c *APIConfig) Validate() error {
if _, err := url.ParseRequestURI(c.BaseURL); err != nil {
return fmt.Errorf("invalid base URL: %w", err)
}
return nil
}
Loading

0 comments on commit 3413a0e

Please sign in to comment.