working commit
This commit is contained in:
@@ -36,6 +36,7 @@ type Config struct {
|
||||
Hostname string `json:"hostname" yaml:"hostname"`
|
||||
Debug bool `json:"debug" yaml:"debug"`
|
||||
Build string `json:"build" yaml:"build"`
|
||||
ConfPath string `json:"conffile" yaml:"conffile"`
|
||||
LogPath string `json:"logfile" yaml:"logfile"`
|
||||
RunPath string `json:"runfile" yaml:"runfile"`
|
||||
DataDir string `json:"datadir" yaml:"datadir"`
|
||||
@@ -74,6 +75,7 @@ func NewConfig() *Config {
|
||||
LogLimit: 1024 * 1024 * 10, // 10 Mb
|
||||
RunUser: "daemon",
|
||||
}
|
||||
conf.ConfPath = filepath.Join(confdirPath, configFilename)
|
||||
conf.LogPath = filepath.Join(logdirPath, logFilename)
|
||||
conf.RunPath = filepath.Join(rundirPath, pidFilename)
|
||||
return conf
|
||||
@@ -81,8 +83,7 @@ func NewConfig() *Config {
|
||||
|
||||
func (conf *Config) ReadFile() error {
|
||||
var err error
|
||||
confPath := filepath.Join(confdirPath, configFilename)
|
||||
confBytes, err := os.ReadFile(confPath)
|
||||
confBytes, err := os.ReadFile(conf.ConfPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package config
|
||||
|
||||
const (
|
||||
confdirPath = "/home/ziggi/Projects/gmbase/etc/mbase"
|
||||
rundirPath = "/home/ziggi/Projects/gmbase/tmp/run"
|
||||
logdirPath = "/home/ziggi/Projects/gmbase/tmp/log"
|
||||
datadirPath = "/home/ziggi/Projects/gmbase/tmp/data"
|
||||
confdirPath = "/usr/local/etc/mbase"
|
||||
rundirPath = "/var/run/mbase"
|
||||
logdirPath = "/var/log/mbase"
|
||||
datadirPath = "/var/data/mbase"
|
||||
packageVersion = "0.0.1"
|
||||
)
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package config
|
||||
|
||||
const (
|
||||
confdirPath = "@srv_confdir@"
|
||||
rundirPath = "@srv_rundir@"
|
||||
logdirPath = "@srv_logdir@"
|
||||
datadirPath = "@srv_datadir@"
|
||||
confdirPath = "@srv_confdir@"
|
||||
rundirPath = "@srv_rundir@"
|
||||
logdirPath = "@srv_logdir@"
|
||||
datadirPath = "@srv_datadir@"
|
||||
packageVersion = "@PACKAGE_VERSION@"
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user