wip: prepareCommand for service completed; next cron

This commit is contained in:
2024-03-24 12:54:37 +00:00
parent 8f68c4ace9
commit a63646aab2
5 changed files with 81 additions and 26 deletions

View File

@@ -2,12 +2,14 @@ package config
import (
"errors"
"gitea.suyono.dev/suyono/wingmate"
"github.com/spf13/viper"
"golang.org/x/sys/unix"
"os"
"path/filepath"
"strings"
"sync"
"gitea.suyono.dev/suyono/wingmate"
"github.com/spf13/viper"
"golang.org/x/sys/unix"
)
const (
@@ -36,6 +38,7 @@ type Config struct {
CronV0 []*Cron
Service []ServiceTask
Cron []CronTask
viperMtx *sync.Mutex
}
type Task struct {
@@ -156,3 +159,17 @@ func Read() (*Config, error) {
return outConfig, nil
}
func (c *Config) WMPidProxyPath() string {
c.viperMtx.Lock()
defer c.viperMtx.Unlock()
return viper.GetString(PidProxyPathConfig)
}
func (c *Config) WMExecPath() string {
c.viperMtx.Lock()
defer c.viperMtx.Unlock()
return viper.GetString(ExecPathConfig)
}