Package Viper:

- Add Getxxxx function from viper into interface to prevent using lib viper and spf viper instance

Package Config:
- change pointer to retrieve config: using golib viper instead of spf viper (allow hook instead of no hook)
This commit is contained in:
Nicolas JUHEL
2024-01-05 16:12:05 +01:00
parent 086cea4702
commit 31cff079a7
12 changed files with 148 additions and 25 deletions

View File

@@ -28,8 +28,8 @@ package tls
import (
libtls "github.com/nabbar/golib/certificates"
libvpr "github.com/nabbar/golib/viper"
spfcbr "github.com/spf13/cobra"
spfvpr "github.com/spf13/viper"
)
func (o *componentTls) RegisterFlag(Command *spfcbr.Command) error {
@@ -40,11 +40,11 @@ func (o *componentTls) _getConfig() (*libtls.Config, error) {
var (
key string
cfg libtls.Config
vpr *spfvpr.Viper
vpr libvpr.Viper
err error
)
if vpr = o._getSPFViper(); vpr == nil {
if vpr = o._getViper(); vpr == nil {
return nil, ErrorComponentNotInitialized.Error(nil)
} else if key = o._getKey(); len(key) < 1 {
return nil, ErrorComponentNotInitialized.Error(nil)