MCPcopy Create free account
hub / github.com/algolia/cli / GetCrawlerUserID

Method GetCrawlerUserID

pkg/config/profile.go:139–156  ·  view source on GitHub ↗

GetCrawlerUserID returns the Crawler user ID.

()

Source from the content-addressed store, hash-verified

137
138// GetCrawlerUserID returns the Crawler user ID.
139func (p *Profile) GetCrawlerUserID() (string, error) {
140 if os.Getenv("ALGOLIA_CRAWLER_USER_ID") != "" {
141 return os.Getenv("ALGOLIA_CRAWLER_USER_ID"), nil
142 }
143
144 if p.Name == "" {
145 p.LoadDefault()
146 }
147
148 if err := viper.ReadInConfig(); err == nil {
149 userID := viper.GetString(p.GetFieldName("crawler_user_id"))
150 if userID != "" {
151 return userID, nil
152 }
153 }
154
155 return "", ErrCrawlerUserIDNotConfigured
156}
157
158// GetCrawlerAPIKey returns the Crawler API key.
159func (p *Profile) GetCrawlerAPIKey() (string, error) {

Callers 1

crawlerClientFunction · 0.80

Calls 2

LoadDefaultMethod · 0.95
GetFieldNameMethod · 0.95

Tested by

no test coverage detected