示例#1
0
文件: conf.go 项目: eeayiaia/scmt
//use to check if scmt has been installed
func Exists() bool {
	root, err := utils.GetScmtRootPath()
	if err != nil {
		log.Warn("SCMT_ROOT not set")
		return false
	}
	_, err = os.Stat(filepath.Join(root, configurationPath))
	return !os.IsNotExist(err)
}
示例#2
0
文件: conf.go 项目: eeayiaia/scmt
func InitConfiguration() {
	// Find path to config file
	rootPath, err := utils.GetScmtRootPath()

	if err != nil {
		panic("Unable to find SCMT root directory")
	}

	Conf = ParseConfiguration(filepath.Join(rootPath, configurationPath))

	if Conf == nil {
		panic("configuration unable to load")
	}

	// Add SCMT_ROOT to config
	Conf.RootPath = rootPath
}
示例#3
0
文件: main.go 项目: eeayiaia/scmt
func main() {
	InitLogging()
	InitContextLogging()

	if conf.Exists() {
		conf.InitConfiguration()
		Config = conf.Conf
		daemon.InitContext(Config.PidFile, Config.LogFile)
	} else {
		_, err := utils.GetScmtRootPath()
		if err == nil {
			FirstSetup()
		}
	}

	Start(func(_ *cli.Context) {
		background()
	})
}