示例#1
0
func newController(conf *controllerConfig) (*controller, error) {
	api, err := api.New()
	if err != nil {
		return nil, err
	}

	c := &controller{
		api:          api,
		omahaHandler: omaha.NewHandler(api),
	}

	if conf.enableSyncer {
		syncerConf := &syncer.Config{
			Api:          api,
			HostPackages: conf.hostCoreosPackages,
			PackagesPath: conf.coreosPackagesPath,
			PackagesURL:  conf.corerollerURL + coreosPkgsRouterPrefix,
		}
		syncer, err := syncer.New(syncerConf)
		if err != nil {
			return nil, err
		}
		c.syncer = syncer
		go syncer.Start()
	}

	return c, nil
}
示例#2
0
func newController() (*controller, error) {
	api, err := api.New()
	if err != nil {
		return nil, err
	}

	syncer, err := syncer.New(api)
	if err != nil {
		return nil, err
	}
	go syncer.Start()

	c := &controller{
		api:    api,
		syncer: syncer,
	}
	c.authenticator = auth.NewDigestAuthenticator("coreroller.org", c.getSecret)

	return c, nil
}