Commit 64722b5
authored
feat: connect() falls back to CAPISCIO_API_KEY env var (#62)
* feat: connect() falls back to CAPISCIO_API_KEY env var
CapiscIO.connect() now reads api_key, agent_id, and server_url
from environment variables when not passed explicitly:
export CAPISCIO_API_KEY=sk_live_...
agent = CapiscIO.connect() # just works
This makes the zero-argument call the simplest path for users
who have already set their env vars. from_env() still exists
for the additional CAPISCIO_AGENT_NAME and CAPISCIO_DEV_MODE
env vars.
* fix: handle empty CAPISCIO_SERVER_URL env var + add connect() env fallback tests
- Empty/whitespace CAPISCIO_SERVER_URL now falls back to PROD_REGISTRY
instead of passing empty string to httpx
- Added 4 unit tests for connect() env var fallback behavior:
reads from env, raises when missing, handles empty server_url,
reads custom server_url1 parent eb637f3 commit 64722b5
2 files changed
Lines changed: 67 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
263 | 263 | | |
264 | 264 | | |
265 | 265 | | |
266 | | - | |
| 266 | + | |
267 | 267 | | |
268 | 268 | | |
269 | 269 | | |
270 | | - | |
| 270 | + | |
271 | 271 | | |
272 | 272 | | |
273 | 273 | | |
| |||
285 | 285 | | |
286 | 286 | | |
287 | 287 | | |
288 | | - | |
| 288 | + | |
| 289 | + | |
289 | 290 | | |
290 | | - | |
291 | | - | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
292 | 295 | | |
293 | 296 | | |
294 | 297 | | |
| |||
299 | 302 | | |
300 | 303 | | |
301 | 304 | | |
| 305 | + | |
302 | 306 | | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
303 | 311 | | |
304 | 312 | | |
305 | 313 | | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
306 | 327 | | |
307 | 328 | | |
308 | 329 | | |
| |||
329 | 350 | | |
330 | 351 | | |
331 | 352 | | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | 353 | | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
340 | 358 | | |
341 | | - | |
342 | | - | |
343 | 359 | | |
344 | | - | |
345 | 360 | | |
346 | 361 | | |
347 | 362 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
258 | 258 | | |
259 | 259 | | |
260 | 260 | | |
261 | | - | |
262 | | - | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
263 | 297 | | |
264 | 298 | | |
265 | 299 | | |
| |||
268 | 302 | | |
269 | 303 | | |
270 | 304 | | |
271 | | - | |
| 305 | + | |
272 | 306 | | |
273 | 307 | | |
274 | 308 | | |
| |||
288 | 322 | | |
289 | 323 | | |
290 | 324 | | |
291 | | - | |
292 | | - | |
293 | 325 | | |
294 | | - | |
295 | 326 | | |
296 | 327 | | |
297 | 328 | | |
| |||
308 | 339 | | |
309 | 340 | | |
310 | 341 | | |
311 | | - | |
312 | | - | |
313 | 342 | | |
314 | | - | |
315 | 343 | | |
316 | 344 | | |
317 | 345 | | |
| |||
0 commit comments