-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #177 from tphakala/config-refactor
refactor: Refactor configuration package to improve settings handling
- Loading branch information
Showing
3 changed files
with
115 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// conf/validate.go config settings validation code goes here | ||
package conf | ||
|
||
import "errors" | ||
|
||
// validateSettings validates the settings | ||
func validateSettings(settings *Settings) error { | ||
// Add your validation logic here | ||
if settings.Realtime.MQTT.Enabled && settings.Realtime.MQTT.Broker == "" { | ||
return errors.New("MQTT broker URL is required when MQTT is enabled") | ||
} | ||
// Other options to validate go here | ||
|
||
return nil | ||
} |