MCPcopy Create free account
hub / github.com/Chat2AnyLLM/code-agent-manager / Run

Method Run

internal/doctor/checks.go:202–252  ·  view source on GitHub ↗
(_ context.Context, r Reporter)

Source from the content-addressed store, hash-verified

200
201func (c GeminiAuthCheck) Name() string { return "Gemini / Vertex Authentication Check" }
202func (c GeminiAuthCheck) Run(_ context.Context, r Reporter) Result {
203 env := c.Env
204 if env == nil {
205 env = os.Getenv
206 }
207 res := Result{}
208 if env("GEMINI_API_KEY") != "" {
209 r.Pass("GEMINI_API_KEY is set in the environment")
210 return res
211 }
212 vertexVars := []string{
213 "GOOGLE_APPLICATION_CREDENTIALS",
214 "GOOGLE_CLOUD_PROJECT",
215 "GOOGLE_CLOUD_LOCATION",
216 "GOOGLE_GENAI_USE_VERTEXAI",
217 }
218 present := []string{}
219 missing := []string{}
220 for _, v := range vertexVars {
221 if env(v) != "" {
222 present = append(present, v)
223 } else {
224 missing = append(missing, v)
225 }
226 }
227 if len(present) == len(vertexVars) {
228 gac := env("GOOGLE_APPLICATION_CREDENTIALS")
229 if gac != "" {
230 if pathutil.Exists(pathutil.Expand(gac)) {
231 r.Pass("Vertex AI credentials configured (GOOGLE_APPLICATION_CREDENTIALS file exists)")
232 } else {
233 res.Issues++
234 r.Warn("GOOGLE_APPLICATION_CREDENTIALS file does not exist",
235 "Check path: "+gac)
236 }
237 } else {
238 r.Pass("Vertex AI variables are set")
239 }
240 return res
241 }
242 if len(present) > 0 {
243 res.Issues++
244 r.Warn("Partial Vertex AI configuration present (missing: "+strings.Join(missing, ", ")+")",
245 "Set all required GOOGLE_* vars or use GEMINI_API_KEY")
246 return res
247 }
248 res.Issues++
249 r.Warn("No Gemini or Vertex authentication detected",
250 "Set GEMINI_API_KEY or configure Vertex AI environment variables")
251 return res
252}
253
254// CopilotAuthCheck reports whether GITHUB_TOKEN is set.
255type CopilotAuthCheck struct {

Callers

nothing calls this directly

Calls 4

ExistsFunction · 0.92
ExpandFunction · 0.92
PassMethod · 0.65
WarnMethod · 0.65

Tested by

no test coverage detected