36 lines
994 B
Go
36 lines
994 B
Go
package hwsauth
|
|
|
|
import "runtime"
|
|
|
|
// EZConfIntegration provides integration with ezconf for automatic configuration
|
|
type EZConfIntegration struct{}
|
|
|
|
// PackagePath returns the path to the hwsauth package for source parsing
|
|
func (e EZConfIntegration) PackagePath() string {
|
|
_, filename, _, _ := runtime.Caller(0)
|
|
// Return directory of this file
|
|
return filename[:len(filename)-len("/ezconf.go")]
|
|
}
|
|
|
|
// ConfigFunc returns the ConfigFromEnv function for ezconf
|
|
func (e EZConfIntegration) ConfigFunc() func() (any, error) {
|
|
return func() (any, error) {
|
|
return ConfigFromEnv()
|
|
}
|
|
}
|
|
|
|
// Name returns the name to use when registering with ezconf
|
|
func (e EZConfIntegration) Name() string {
|
|
return "hwsauth"
|
|
}
|
|
|
|
// GroupName returns the display name for grouping environment variables
|
|
func (e EZConfIntegration) GroupName() string {
|
|
return "HWSAuth"
|
|
}
|
|
|
|
// NewEZConfIntegration creates a new EZConf integration helper
|
|
func NewEZConfIntegration() EZConfIntegration {
|
|
return EZConfIntegration{}
|
|
}
|