Example #1
0
//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)
}
Example #2
0
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
}
Example #3
0
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()
	})
}