add: contactController,tests & refactored tests
This commit is contained in:
@@ -43,23 +43,30 @@ type TemplateConfig struct {
|
||||
StaticPath string `json:"StaticPath" default:"templates/css" envconfig:"TEMPLATE_STATIC_PATH"`
|
||||
}
|
||||
|
||||
type RecipientsConfig struct {
|
||||
ContactForm string `json:"ContactForm" envconfig:"RECIPIENT_CONTACT_FORM"`
|
||||
UserRegistration string `json:"UserRegistration" envconfig:"RECIPIENT_USER_REGISTRATION"`
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
ConfigFilePath string `json:"config_file_path" envconfig:"CONFIG_FILE_PATH"`
|
||||
BaseURL string `json:"base_url" envconfig:"BASE_URL"`
|
||||
Auth AuthenticationConfig `json:"auth"`
|
||||
DB DatabaseConfig `json:"db"`
|
||||
Templates TemplateConfig `json:"templates"`
|
||||
Recipients RecipientsConfig `json:"recipients"`
|
||||
ConfigFilePath string `json:"config_file_path" envconfig:"CONFIG_FILE_PATH"`
|
||||
BaseURL string `json:"BaseUrl" envconfig:"BASE_URL"`
|
||||
DB DatabaseConfig `json:"db"`
|
||||
SMTP SMTPConfig `json:"smtp"`
|
||||
}
|
||||
|
||||
var (
|
||||
BaseURL string
|
||||
CFGPath string
|
||||
CFG Config
|
||||
Auth AuthenticationConfig
|
||||
DB DatabaseConfig
|
||||
Templates TemplateConfig
|
||||
SMTP SMTPConfig
|
||||
BaseURL string
|
||||
CFGPath string
|
||||
CFG Config
|
||||
Auth AuthenticationConfig
|
||||
DB DatabaseConfig
|
||||
Templates TemplateConfig
|
||||
SMTP SMTPConfig
|
||||
Recipients RecipientsConfig
|
||||
)
|
||||
|
||||
// LoadConfig initializes the configuration by reading from a file and environment variables.
|
||||
@@ -86,6 +93,7 @@ func LoadConfig() {
|
||||
Templates = CFG.Templates
|
||||
SMTP = CFG.SMTP
|
||||
BaseURL = CFG.BaseURL
|
||||
Recipients = CFG.Recipients
|
||||
}
|
||||
|
||||
// readFile reads the configuration from the specified file path into the provided Config struct.
|
||||
|
||||
Reference in New Issue
Block a user