func (s *Site) initializeSiteInfo() { params := viper.GetStringMap("Params") permalinks := make(PermalinkOverrides) for k, v := range viper.GetStringMapString("Permalinks") { permalinks[k] = PathPattern(v) } s.Info = SiteInfo{ BaseUrl: template.URL(helpers.SanitizeUrlKeepTrailingSlash(viper.GetString("BaseUrl"))), Title: viper.GetString("Title"), Author: viper.GetStringMap("author"), LanguageCode: viper.GetString("languagecode"), Copyright: viper.GetString("copyright"), DisqusShortname: viper.GetString("DisqusShortname"), BuildDrafts: viper.GetBool("BuildDrafts"), canonifyUrls: viper.GetBool("CanonifyUrls"), Pages: &s.Pages, Recent: &s.Pages, Menus: &s.Menus, Params: params, Permalinks: permalinks, Data: &s.Data, } }
func (s *Site) initializeSiteInfo() { params := viper.GetStringMap("Params") permalinks := make(PermalinkOverrides) for k, v := range viper.GetStringMapString("Permalinks") { permalinks[k] = PathPattern(v) } s.Info = SiteInfo{ BaseURL: template.URL(helpers.SanitizeURLKeepTrailingSlash(viper.GetString("BaseURL"))), Title: viper.GetString("Title"), Author: viper.GetStringMap("author"), Social: viper.GetStringMapString("social"), LanguageCode: viper.GetString("languagecode"), Copyright: viper.GetString("copyright"), DisqusShortname: viper.GetString("DisqusShortname"), GoogleAnalytics: viper.GetString("GoogleAnalytics"), RSSLink: s.permalinkStr(viper.GetString("RSSUri")), BuildDrafts: viper.GetBool("BuildDrafts"), canonifyURLs: viper.GetBool("CanonifyURLs"), preserveTaxonomyNames: viper.GetBool("PreserveTaxonomyNames"), Pages: &s.Pages, Menus: &s.Menus, Params: params, Permalinks: permalinks, Data: &s.Data, } }
func main() { flag.Parse() // Scan the arguments list InitializeConfig() graphite := fmt.Sprintf("%s%s%s", viper.GetString("graphite.host"), ":", viper.GetString("graphite.port")) prefix := fmt.Sprintf("%s", viper.GetString("graphite.prefix")) if *versionFlag { fmt.Println("cnm2g: Cn=monitor to Graphite") fmt.Println("Version:", APP_VERSION) fmt.Println("Config File >>>", viper.ConfigFileUsed()) fmt.Println("Graphite >>>", graphite) fmt.Println("Prefix >>>", prefix) return } ldapmap := viper.GetStringMap("ldap") dnmap := viper.GetStringMap("dn") for ldap, _ := range ldapmap { ldapuri := viper.GetString(fmt.Sprintf("ldap.%s.uri", ldap)) ldapuser := viper.GetString(fmt.Sprintf("ldap.%s.user", ldap)) ldappass := viper.GetString(fmt.Sprintf("ldap.%s.pass", ldap)) for dn, _ := range dnmap { prefixldap := fmt.Sprintf("%s.%s.%s", prefix, ldap, dn) data := viper.GetStringSlice(fmt.Sprintf("dn.%s.data", dn)) basedn := viper.GetString(fmt.Sprintf("dn.%s.dn", dn)) ldapresult := FetchData(ldapuri, ldapuser, ldappass, basedn, "(objectclass=*)", data) if DEBUG { ShowData(graphite, prefixldap, ldapresult) } else { SentData(graphite, prefixldap, ldapresult) } } } }
// NewBlackfriday creates a new Blackfriday filled with site config or some sane defaults. func NewBlackfriday() *Blackfriday { combinedParam := map[string]interface{}{ "smartypants": true, "angledQuotes": false, "fractions": true, "hrefTargetBlank": false, "smartDashes": true, "latexDashes": true, "plainIDAnchors": true, "sourceRelativeLinks": false, "sourceRelativeLinksProjectFolder": "/docs/content", } siteParam := viper.GetStringMap("blackfriday") if siteParam != nil { siteConfig := cast.ToStringMap(siteParam) for key, value := range siteConfig { combinedParam[key] = value } } combinedConfig := &Blackfriday{} if err := mapstructure.Decode(combinedParam, combinedConfig); err != nil { jww.FATAL.Printf("Failed to get site rendering config\n%s", err.Error()) } return combinedConfig }
func GetStringMapBool(key, mkey string) (error, bool) { m := viper.GetStringMap(key)[mkey] if m != nil { return nil, m.(bool) } return errors.New("can't found:" + key + "," + mkey), false }
func (s *Site) getMenusFromConfig() Menus { ret := Menus{} if menus := viper.GetStringMap("menu"); menus != nil { for name, menu := range menus { m, err := cast.ToSliceE(menu) if err != nil { jww.ERROR.Printf("unable to process menus in site config\n") jww.ERROR.Println(err) } else { for _, entry := range m { jww.DEBUG.Printf("found menu: %q, in site config\n", name) menuEntry := MenuEntry{Menu: name} ime, err := cast.ToStringMapE(entry) if err != nil { jww.ERROR.Printf("unable to process menus in site config\n") jww.ERROR.Println(err) } menuEntry.MarshallMap(ime) if ret[name] == nil { ret[name] = &Menu{} } *ret[name] = ret[name].Add(&menuEntry) } } } return ret } return ret }
func (p *Page) getRenderingConfig() *helpers.Blackfriday { p.renderingConfigInit.Do(func() { pageParam := p.GetParam("blackfriday") siteParam := viper.GetStringMap("blackfriday") combinedParam := siteParam if pageParam != nil { combinedParam = make(map[string]interface{}) for k, v := range siteParam { combinedParam[k] = v } pageConfig := cast.ToStringMap(pageParam) for key, value := range pageConfig { combinedParam[key] = value } } p.renderingConfig = helpers.NewBlackfriday() if err := mapstructure.Decode(combinedParam, p.renderingConfig); err != nil { jww.FATAL.Printf("Failed to get rendering config for %s:\n%s", p.BaseFileName(), err.Error()) } }) return p.renderingConfig }
func main() { // config defaults viper.SetDefault("SigningKey", "change me in config/app.toml") viper.SetDefault("Port", "8888") viper.SetDefault("Database", "postgresql") viper.SetConfigType("toml") viper.SetConfigName("app") viper.AddConfigPath("./config/") // TODO better error message err := viper.ReadInConfig() if err != nil { fmt.Print(fmt.Errorf("Fatal error config file: %s \n", err)) fmt.Println("Config path is ./config/, and name should be app.toml") fmt.Println("Using defaults") } // TODO: check toml for nested propeties // TODO: Handle config in a separate module? file? dbConfig := viper.GetStringMap("Database") dbName := dbConfig["Name"] dbUser := dbConfig["User"] // fmt.Sprintf("user=%s dbname=%s sslmode=disable", dbUser, dbName) dbOptions := db.Options{ Driver: "postgres", Params: fmt.Sprintf("user=%s dbname=%s sslmode=disable", dbUser, dbName), } dbConnection := db.Connect(dbOptions) app := NewApp([]byte(viper.GetString("SigningKey")), dbConnection) port := viper.GetString("Port") log.Printf("Serving on port: %s\n", port) app.E.Run(":" + port) }
// NewState constructs a new State. This Initializes encapsulated state implementation func NewState() *State { stateImplName := viper.GetString("ledger.state.dataStructure.name") stateImplConfigs := viper.GetStringMap("ledger.state.dataStructure.configs") if len(stateImplName) == 0 { stateImplName = detaultStateImpl stateImplConfigs = nil } logger.Info("Initializing state implementation [%s]", stateImplName) switch stateImplName { case "buckettree": stateImpl = buckettree.NewStateImpl() case "trie": stateImpl = trie.NewStateTrie() case "raw": stateImpl = raw.NewRawState() default: panic(fmt.Errorf("Error during initialization of state implementation. State data structure '%s' is not valid.", stateImplName)) } err := stateImpl.Initialize(stateImplConfigs) if err != nil { panic(fmt.Errorf("Error during initialization of state implementation: %s", err)) } deltaHistorySize := viper.GetInt("ledger.state.deltaHistorySize") if deltaHistorySize < 0 { panic(fmt.Errorf("Delta history size must be greater than or equal to 0. Current value is %d.", deltaHistorySize)) } return &State{stateImpl, statemgmt.NewStateDelta(), statemgmt.NewStateDelta(), "", make(map[string][]byte), false, uint64(deltaHistorySize)} }
func TestConfigInit(t *testing.T) { configs := viper.GetStringMap("ledger.state.dataStructure.configs") t.Logf("Configs loaded from yaml = %#v", configs) testDBWrapper.CleanDB(t) stateImpl := NewStateImpl() stateImpl.Initialize(configs) testutil.AssertEquals(t, conf.getNumBucketsAtLowestLevel(), configs[ConfigNumBuckets]) testutil.AssertEquals(t, conf.getMaxGroupingAtEachLevel(), configs[ConfigMaxGroupingAtEachLevel]) }
func (s *Site) RenderSitemap() error { if viper.GetBool("DisableSitemap") { return nil } sitemapDefault := parseSitemap(viper.GetStringMap("Sitemap")) optChanged := false n := s.NewNode() // Prepend homepage to the list of pages pages := make(Pages, 0) page := &Page{} page.Date = s.Info.LastChange page.Site = &s.Info page.Url = "/" pages = append(pages, page) pages = append(pages, s.Pages...) n.Data["Pages"] = pages for _, page := range pages { if page.Sitemap.ChangeFreq == "" { page.Sitemap.ChangeFreq = sitemapDefault.ChangeFreq } if page.Sitemap.Priority == -1 { page.Sitemap.Priority = sitemapDefault.Priority } } // Force `UglyUrls` option to force `sitemap.xml` file name switch s.PageTarget().(type) { case *target.Filesystem: s.PageTarget().(*target.PagePub).UglyUrls = true optChanged = true } smLayouts := []string{"sitemap.xml", "_default/sitemap.xml", "_internal/_default/sitemap.xml"} b, err := s.renderXML("sitemap", n, s.appendThemeTemplates(smLayouts)...) if err != nil { return err } if err := s.WriteDestFile("sitemap.xml", b); err != nil { return err } if optChanged { s.PageTarget().(*target.PagePub).UglyUrls = viper.GetBool("UglyUrls") } return nil }
func GetServer(key string) string { env := viper.Get("env") confEnv := viper.GetStringMap("development") switch env { case "development": value, _ := mapServer(confEnv)[key].(string) return value case "production": confEnv := viper.GetStringMap("production") value, _ := mapServer(confEnv)[key].(string) return value case "testing": confEnv := viper.GetStringMap("testing") value, _ := mapServer(confEnv)[key].(string) return value default: log.Panic("Missing config environment") } return "" }
func init() { flag.Parse() config.SetConfigFile(*configFileName) err := config.ReadInConfig() if err != nil { panic("Config file not found") } logConfig := config.GetStringMap("log") initLog(logConfig) }
func GetCliOrConfig(c string, cli interface{}) interface{} { val := cli if cli == "" { if strings.Contains(c, "/") { s := strings.Split(c, "/") return viper.GetStringMap(s[0])[s[1]] } else { return Get(c) } } return val }
func startHttpTestsFromConfig() { for name := range viper.GetStringMap("health_checks") { prefix := fmt.Sprintf("health_checks.%s.", name) testType := viper.GetString(prefix + "type") switch testType { case "http": startHttpTest(getHttpConfig(name, prefix)) default: fmt.Errorf("Cannot handle test type: %s", testType) } } }
func loadConfigs() { genesisLogger.Info("Loading configurations...") genesis = viper.GetStringMap("ledger.blockchain.genesisBlock") mode = viper.GetString("chaincode.chaincoderunmode") genesisLogger.Info("Configurations loaded: genesis=%s, mode=[%s], deploySystemChaincodeEnabled=[%t]", genesis, mode, deploySystemChaincodeEnabled) if viper.IsSet("ledger.blockchain.deploy-system-chaincode") { // If the deployment of system chaincode is enabled in the configuration file return the configured value deploySystemChaincodeEnabled = viper.GetBool("ledger.blockchain.deploy-system-chaincode") } else { // Deployment of system chaincode is enabled by default if no configuration was specified. deploySystemChaincodeEnabled = true } }
func (l *Language) Params() map[string]interface{} { l.paramsInit.Do(func() { // Merge with global config. // TODO(bep) consider making this part of a constructor func. globalParams := viper.GetStringMap("Params") for k, v := range globalParams { if _, ok := l.params[k]; !ok { l.params[k] = v } } }) return l.params }
func initServerConfig() { s := viper.GetStringMap("server") host := s["host"] if host == nil { srv.Config.Host = defaultServerHost } else { srv.Config.Host = host.(string) } port := s["port"] if port == nil { srv.Config.Port = defaultServerPort } else { srv.Config.Port = port.(uint) } }
func loadEndpointsConfig() { //Login Config.LoginURI = viper.GetString("stormpath.web.login.uri") Config.LoginNextURI = viper.GetString("stormpath.web.login.nextUri") Config.LoginView = viper.GetString("stormpath.web.login.view") Config.LoginEnabled = viper.GetBool("stormpath.web.login.enabled") //Register Config.RegisterURI = viper.GetString("stormpath.web.register.uri") Config.RegisterView = viper.GetString("stormpath.web.register.view") Config.RegisterNextURI = viper.GetString("stormpath.web.register.uri") Config.RegisterEnabled = viper.GetBool("stormpath.web.register.enabled") Config.RegisterAutoLoginEnabled = viper.GetBool("stormpath.web.register.autoLogin") //Verify Config.VerifyURI = viper.GetString("stormpath.web.verifyEmail.uri") Config.VerifyEnabled = loadBoolPtr("stormpath.web.verifyEmail.enabled") Config.VerifyView = viper.GetString("stormpath.web.verifyEmail.view") Config.VerifyNextURI = viper.GetString("stormpath.web.verifyEmail.nextUri") //Forgot Password Config.ForgotPasswordURI = viper.GetString("stormpath.web.forgotPassword.uri") Config.ForgotPasswordNextURI = viper.GetString("stormpath.web.forgotPassword.nextUri") Config.ForgotPasswordView = viper.GetString("stormpath.web.forgotPassword.view") Config.ForgotPasswordEnabled = loadBoolPtr("stormpath.web.forgotPassword.enabled") //Change Password Config.ChangePasswordURI = viper.GetString("stormpath.web.changePassword.uri") Config.ChangePasswordNextURI = viper.GetString("stormpath.web.changePassword.nextUri") Config.ChangePasswordView = viper.GetString("stormpath.web.changePassword.view") Config.ChangePasswordEnabled = loadBoolPtr("stormpath.web.changePassword.enabled") Config.ChangePasswordAutoLoginEnabled = viper.GetBool("stormpath.web.changePassword.autoLogin") Config.ChangePasswordErrorURI = viper.GetString("stormpath.web.changePassword.errorUri") //Logout Config.LogoutURI = viper.GetString("stormpath.web.logout.uri") Config.LogoutNextURI = viper.GetString("stormpath.web.logout.nextUri") Config.LogoutEnabled = viper.GetBool("stormpath.web.logout.enabled") //IDSite Config.IDSiteEnabled = viper.GetBool("stormpath.web.idSite.enabled") Config.IDSiteLoginURI = viper.GetString("stormpath.web.idSite.loginUri") Config.IDSiteForgotURI = viper.GetString("stormpath.web.idSite.forgotUri") Config.IDSiteRegisterURI = viper.GetString("stormpath.web.idSite.registerUri") Config.CallbackEnabled = viper.GetBool("stormpath.web.callback.enabled") Config.CallbackURI = viper.GetString("stormpath.web.callback.uri") //Me Config.MeEnabled = viper.GetBool("stormpath.web.me.enabled") Config.MeURI = viper.GetString("stormpath.web.me.uri") Config.MeExpand = viper.GetStringMap("stormpath.web.me.expand") }
func (s *Site) RenderSitemap() error { if viper.GetBool("DisableSitemap") { return nil } sitemapDefault := parseSitemap(viper.GetStringMap("Sitemap")) n := s.NewNode() // Prepend homepage to the list of pages pages := make(Pages, 0) page := &Page{} page.Date = s.Info.LastChange page.Lastmod = s.Info.LastChange page.Site = &s.Info page.URL = "/" pages = append(pages, page) pages = append(pages, s.Pages...) n.Data["Pages"] = pages for _, page := range pages { if page.Sitemap.ChangeFreq == "" { page.Sitemap.ChangeFreq = sitemapDefault.ChangeFreq } if page.Sitemap.Priority == -1 { page.Sitemap.Priority = sitemapDefault.Priority } if page.Sitemap.Filename == "" { page.Sitemap.Filename = sitemapDefault.Filename } } smLayouts := []string{"sitemap.xml", "_default/sitemap.xml", "_internal/_default/sitemap.xml"} if err := s.renderAndWriteXML("sitemap", page.Sitemap.Filename, n, s.appendThemeTemplates(smLayouts)...); err != nil { return err } return nil }
func (s *Site) getMenusFromConfig() Menus { ret := Menus{} if menus := viper.GetStringMap("menu"); menus != nil { for name, menu := range menus { m, err := cast.ToSliceE(menu) if err != nil { jww.ERROR.Printf("unable to process menus in site config\n") jww.ERROR.Println(err) } else { for _, entry := range m { jww.DEBUG.Printf("found menu: %q, in site config\n", name) menuEntry := MenuEntry{Menu: name} ime, err := cast.ToStringMapE(entry) if err != nil { jww.ERROR.Printf("unable to process menus in site config\n") jww.ERROR.Println(err) } menuEntry.MarshallMap(ime) if strings.HasPrefix(menuEntry.Url, "/") { // make it match the nodes menuEntryUrl := menuEntry.Url menuEntryUrl = helpers.UrlizeAndPrep(menuEntryUrl) if !s.Info.canonifyUrls { menuEntryUrl = helpers.AddContextRoot(string(s.Info.BaseUrl), menuEntryUrl) } menuEntry.Url = menuEntryUrl } if ret[name] == nil { ret[name] = &Menu{} } *ret[name] = ret[name].Add(&menuEntry) } } } return ret } return ret }
//TestViper try to use viper func TestViper() { viper.AddConfigPath("/home/xiaoju/goworkspace/goplayground/") viper.SetConfigName("test") viper.SetConfigType("toml") err := viper.ReadInConfig() if err != nil { fmt.Println("read viper configure", err) } // var x int if viper.IsSet("logger.meta.other.xo") { x = viper.GetInt("logger.meta.other.xo") } else { x = 8 } if viper.IsSet("logger.meta.input") { metaInput := viper.GetStringMap("logger.meta.input") for k, v := range metaInput { // if viper.IsSet("logger.meta.input." + k) { // kv := viper.GetStringMapString("logger.meta.input." + k) // for x, y := range kv { // fmt.Println(x, y) // } // } fmt.Println(k, v) if value, ok := v.(map[string]string); ok { for x, y := range value { fmt.Println(x, y) } } else { fmt.Println(ok) } } } // for k, v := range logConf["meta"]["input"] { // fmt.Println(k, v) // } fmt.Println(x) }
func loadConfig() { logger.Info("Loading configurations...") stateImplName = viper.GetString("ledger.state.dataStructure.name") stateImplConfigs = viper.GetStringMap("ledger.state.dataStructure.configs") deltaHistorySize = viper.GetInt("ledger.state.deltaHistorySize") logger.Info("Configurations loaded. stateImplName=[%s], stateImplConfigs=%s, deltaHistorySize=[%d]", stateImplName, stateImplConfigs, deltaHistorySize) if len(stateImplName) == 0 { stateImplName = detaultStateImpl stateImplConfigs = nil } else if stateImplName != "buckettree" && stateImplName != "trie" && stateImplName != "raw" { panic(fmt.Errorf("Error during initialization of state implementation. State data structure '%s' is not valid.", stateImplName)) } if deltaHistorySize < 0 { panic(fmt.Errorf("Delta history size must be greater than or equal to 0. Current value is %d.", deltaHistorySize)) } }
func (p *Page) getRenderingConfig() *helpers.Blackfriday { p.renderingConfigInit.Do(func() { pageParam := p.GetParam("blackfriday") siteParam := viper.GetStringMap("blackfriday") if pageParam != nil { pageConfig := cast.ToStringMap(pageParam) for key, value := range pageConfig { siteParam[key] = value } } p.renderingConfig = new(helpers.Blackfriday) if err := mapstructure.Decode(siteParam, p.renderingConfig); err != nil { jww.FATAL.Printf("Failed to get rendering config for %s:\n%s", p.BaseFileName(), err.Error()) } }) return p.renderingConfig }
// NewFile creates a new File pointer with the given relative path. func NewFile(relpath string) *File { f := &File{ relpath: relpath, } f.dir, f.logicalName = filepath.Split(f.relpath) f.ext = strings.TrimPrefix(filepath.Ext(f.LogicalName()), ".") f.baseName = helpers.Filename(f.LogicalName()) lang := strings.TrimPrefix(filepath.Ext(f.baseName), ".") if _, ok := viper.GetStringMap("languages")[lang]; lang == "" || !ok { f.lang = viper.GetString("defaultContentLanguage") f.translationBaseName = f.baseName } else { f.lang = lang f.translationBaseName = helpers.Filename(f.baseName) } f.section = helpers.GuessSection(f.Dir()) f.uniqueID = helpers.Md5String(f.LogicalName()) return f }
func (s *Site) getMenusFromConfig() Menus { ret := Menus{} if menus := viper.GetStringMap("menu"); menus != nil { for name, menu := range menus { m, err := cast.ToSliceE(menu) if err != nil { jww.ERROR.Printf("unable to process menus in site config\n") jww.ERROR.Println(err) } else { for _, entry := range m { jww.DEBUG.Printf("found menu: %q, in site config\n", name) menuEntry := MenuEntry{Menu: name} ime, err := cast.ToStringMapE(entry) if err != nil { jww.ERROR.Printf("unable to process menus in site config\n") jww.ERROR.Println(err) } menuEntry.MarshallMap(ime) if strings.HasPrefix(menuEntry.Url, "/") { // make it absolute so it matches the nodes menuEntry.Url = s.permalinkStr(menuEntry.Url) } if ret[name] == nil { ret[name] = &Menu{} } *ret[name] = ret[name].Add(&menuEntry) } } } return ret } return ret }
func createSitesFromConfig() ([]*Site, error) { var sites []*Site multilingual := viper.GetStringMap("Languages") if len(multilingual) == 0 { sites = append(sites, newSite(helpers.NewDefaultLanguage())) } if len(multilingual) > 0 { var err error languages, err := toSortedLanguages(multilingual) if err != nil { return nil, fmt.Errorf("Failed to parse multilingual config: %s", err) } for _, lang := range languages { sites = append(sites, newSite(lang)) } } return sites, nil }
// Render the cross-site artifacts. func (h *HugoSites) render() error { if !h.multilingual.enabled() { return nil } if viper.GetBool("DisableSitemap") { return nil } // TODO(bep) DRY sitemapDefault := parseSitemap(viper.GetStringMap("Sitemap")) s := h.Sites[0] smLayouts := []string{"sitemapindex.xml", "_default/sitemapindex.xml", "_internal/_default/sitemapindex.xml"} if err := s.renderAndWriteXML("sitemapindex", sitemapDefault.Filename, h.toSiteInfos(), s.appendThemeTemplates(smLayouts)...); err != nil { return err } return nil }
func loadConfigs() { genesisLogger.Info("Loading configurations...") genesis = viper.GetStringMap("ledger.blockchain.genesisBlock") genesisLogger.Info("Configurations loaded: genesis=%s", genesis) }
func sync(inst *install.Install, force bool) { var err error if inst == nil { client := consulClient() inst, err = install.NewInstall(client, nil, nil, nil) if err != nil { log.Fatalf("Could not create install client: %v", err) } } defaultSources := []*install.Source{ &install.Source{ Name: "mantl", Path: "https://github.com/CiscoCloud/mantl-universe.git", SourceType: install.Git, Branch: "master", Index: 1, }, &install.Source{ Name: "mesosphere", Path: "https://github.com/mesosphere/universe.git", SourceType: install.Git, Index: 0, }, } sources := []*install.Source{} configuredSources := viper.GetStringMap("sources") if len(configuredSources) > 0 { for name, val := range configuredSources { source := &install.Source{Name: name, SourceType: install.FileSystem} sourceConfig := val.(map[string]interface{}) if path, ok := sourceConfig["path"].(string); ok { source.Path = path } if index, ok := sourceConfig["index"].(int64); ok { source.Index = int(index) } if sourceType, ok := sourceConfig["type"].(string); ok { if strings.EqualFold(sourceType, "git") { source.SourceType = install.Git } } if branch, ok := sourceConfig["branch"].(string); ok { source.Branch = branch } if source.IsValid() { sources = append(sources, source) } else { log.Warnf("Invalid source configuration for %s", name) } } } if len(sources) == 0 { sources = defaultSources } inst.SyncSources(sources, force) }