summaryrefslogtreecommitdiff
path: root/utils/env/validators.go
diff options
context:
space:
mode:
authorBobby <[email protected]>2025-12-18 16:29:07 +0530
committerBobby <[email protected]>2025-12-18 16:29:07 +0530
commit74209da9580c7ae63898664437dc7d021010d29a (patch)
tree90cba8e61cd5dc8c8fa62e7cc3ac798b2962dc6e /utils/env/validators.go
parent25f73ff8a0bbfc1f7c0ca8eab46c510e8d2624ef (diff)
downloadlain-74209da9580c7ae63898664437dc7d021010d29a.tar.xz
lain-74209da9580c7ae63898664437dc7d021010d29a.zip
add config and makefile
Diffstat (limited to 'utils/env/validators.go')
-rw-r--r--utils/env/validators.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/utils/env/validators.go b/utils/env/validators.go
new file mode 100644
index 0000000..fa9b17f
--- /dev/null
+++ b/utils/env/validators.go
@@ -0,0 +1,15 @@
+package env
+
+import (
+ "fmt"
+ "reflect"
+)
+
+func validateConfigInput(config any) (reflect.Value, reflect.Type, error) {
+ v := reflect.ValueOf(config)
+ if v.Kind() != reflect.Pointer || v.Elem().Kind() != reflect.Struct {
+ return reflect.Value{}, nil, fmt.Errorf("config must be a pointer to struct")
+ }
+ elem := v.Elem()
+ return elem, elem.Type(), nil
+}