wip: created example files with new config and implementing new config in init
This commit is contained in:
@@ -4,19 +4,43 @@ import (
|
||||
"gitea.suyono.dev/suyono/wingmate/config"
|
||||
wminit "gitea.suyono.dev/suyono/wingmate/init"
|
||||
"gitea.suyono.dev/suyono/wingmate/task"
|
||||
"github.com/spf13/viper"
|
||||
"sync"
|
||||
)
|
||||
|
||||
type wConfig struct {
|
||||
tasks *task.Tasks
|
||||
tasks *task.Tasks
|
||||
config *config.Config
|
||||
viperMtx *sync.Mutex
|
||||
}
|
||||
|
||||
func (c *wConfig) Tasks() wminit.Tasks {
|
||||
return c.tasks
|
||||
}
|
||||
|
||||
func (c *wConfig) WMPidProxyPath() string {
|
||||
c.viperMtx.Lock()
|
||||
defer c.viperMtx.Unlock()
|
||||
|
||||
return viper.GetString(config.PidProxyPathConfig)
|
||||
}
|
||||
|
||||
func (c *wConfig) WMExecPath() string {
|
||||
c.viperMtx.Lock()
|
||||
defer c.viperMtx.Unlock()
|
||||
|
||||
return viper.GetString(config.ExecPathConfig)
|
||||
}
|
||||
|
||||
func (c *wConfig) Reload() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func convert(cfg *config.Config) *wConfig {
|
||||
retval := &wConfig{
|
||||
tasks: task.NewTasks(),
|
||||
tasks: task.NewTasks(),
|
||||
config: cfg,
|
||||
viperMtx: &sync.Mutex{},
|
||||
}
|
||||
|
||||
for _, s := range cfg.Service {
|
||||
|
||||
@@ -14,7 +14,7 @@ func TestEntry_configPathEnv(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestEntry_configPathPFlag(t *testing.T) {
|
||||
os.Args = []string{"wingmate", "--config", "/Volumes/Source/go/src/gitea.suyono.dev/suyono/wingmate/docker/bookworm/etc/wingmate"}
|
||||
os.Args = []string{"wingmate", "--config", "/workspaces/wingmate/docker/bookworm-newconfig/etc/wingmate"}
|
||||
main()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user