GetCrawlerUserID returns the Crawler user ID.
()
| 137 | |
| 138 | // GetCrawlerUserID returns the Crawler user ID. |
| 139 | func (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. |
| 159 | func (p *Profile) GetCrawlerAPIKey() (string, error) { |
no test coverage detected