示例#1
0
文件: org.go 项目: pki-io/controller
func (cont *OrgController) LoadConfig() error {
	logger.Debug("loading org config")

	var err error
	if cont.config == nil {
		cont.config, err = config.NewOrg()
		if err != nil {
			return err
		}
	}

	logger.Debugf("checking if local org config '%s' exists", OrgConfigFile)
	exists, err := cont.env.fs.local.Exists(OrgConfigFile)
	if err != nil {
		return err
	}

	if exists {
		logger.Debug("reading local org config")
		orgConfig, err := cont.env.fs.local.Read(OrgConfigFile)
		if err != nil {
			return err
		}

		err = cont.config.Load(orgConfig)
		if err != nil {
			return err
		}
	}

	logger.Trace("returning nil error")
	return nil
}
示例#2
0
文件: adminApp.go 项目: jawher/admin
func (app *AdminApp) CreateOrgConfig() {
	var err error
	app.config.org, err = config.NewOrg()
	checkAppFatal("Couldn't initialize org config: %s", err)

	app.config.org.Data.Id = app.entities.org.Data.Body.Id
	app.config.org.Data.Name = app.entities.org.Data.Body.Name
}
示例#3
0
文件: adminApp.go 项目: jawher/admin
func (app *AdminApp) LoadOrgConfig() {
	orgConfig, err := app.fs.local.Read(OrgConfigFile)
	checkUserFatal("Couldn't read org config: %s. Are you in an org directory?", err)

	app.config.org, err = config.NewOrg()
	checkAppFatal("Couldn't initialize org config: %s", err)

	err = app.config.org.Load(orgConfig)
	checkAppFatal("Couldn't load org config: %s", err)
}