Example #1
0
func (cont *AdminController) LoadConfig() error {
	logger.Debug("loading admin config")
	var err error
	if cont.config == nil {
		cont.config, err = config.NewAdmin()
		if err != nil {
			return err
		}
	}

	logger.Debugf("checking file '%s' exists", ConfigFile)
	exists, err := cont.env.fs.home.Exists(ConfigFile)
	if err != nil {
		return err
	}

	if exists {
		logger.Debug("reading config file")
		adminConfig, err := cont.env.fs.home.Read(ConfigFile)
		if err != nil {
			return err
		}

		logger.Debug("loading config")
		err = cont.config.Load(adminConfig)
		if err != nil {
			return err
		}
	}

	logger.Trace("returning nil error")
	return nil
}
Example #2
0
func (app *AdminApp) LoadAdminConfig() {
	logger.Info("Loading admin config")
	adminConfig, err := app.fs.home.Read(AdminConfigFile)
	checkAppFatal("Couldn't read admin config: %s", err)

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

	err = app.config.admin.Load(adminConfig)
	checkAppFatal("Couldn't load admin config: %s", err)
}
Example #3
0
func (app *AdminApp) CreateAdminConfig() {
	var err error
	app.config.admin, err = config.NewAdmin()
	checkAppFatal("Couldn't initialize admin config: %s", err)

}