Skip to content

Commit 17ef0a5

Browse files
authored
Merge pull request #9 from ScrapeGraphAI/feat/custom-api-url
feat: add JUST_SCRAPE_API_URL env var to override API base URL
2 parents 5c45326 + 82d53ae commit 17ef0a5

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,14 @@ Four ways to provide it (checked in order):
7979
3. **Config file**: `~/.scrapegraphai/config.json`
8080
4. **Interactive prompt**: the CLI asks and saves to config
8181

82-
```bash
83-
export JUST_SCRAPE_TIMEOUT_S=300 # Request/polling timeout in seconds (default: 120)
84-
JUST_SCRAPE_DEBUG=1 just-scrape ... # Debug logging to stderr
85-
```
82+
### Environment Variables
83+
84+
| Variable | Description | Default |
85+
|---|---|---|
86+
| `SGAI_API_KEY` | ScrapeGraph API key ||
87+
| `JUST_SCRAPE_API_URL` | Override API base URL | `https://api.scrapegraphai.com/v1` |
88+
| `JUST_SCRAPE_TIMEOUT_S` | Request/polling timeout in seconds | `120` |
89+
| `JUST_SCRAPE_DEBUG` | Set to `1` to enable debug logging to stderr | `0` |
8690

8791
## JSON Mode (`--json`)
8892

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "just-scrape",
3-
"version": "0.1.7",
3+
"version": "0.1.8",
44
"description": "ScrapeGraph AI CLI tool",
55
"type": "module",
66
"main": "dist/cli.mjs",

src/lib/scrapegraphai.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export type {
3636
SmartScraperParams,
3737
} from "../types/index.js";
3838

39-
const BASE_URL = "https://api.scrapegraphai.com/v1";
39+
const BASE_URL = process.env.JUST_SCRAPE_API_URL || "https://api.scrapegraphai.com/v1";
4040
const POLL_INTERVAL_MS = 3000;
4141

4242
function debug(label: string, data?: unknown) {

src/utils/banner.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const BANNER = [
1919
"╚═╝╚═╝╚═╝ ╩ ╚═╝╚═╝╩╚═╩ ╩╩ ╚═╝",
2020
];
2121

22-
const TAGLINE = " made with ♥ from scrapegraphai team";
22+
const TAGLINE = "made with ♥ from scrapegraphai team";
2323

2424
const BANNER_COLOR = "#bd93f9";
2525

@@ -30,5 +30,8 @@ export function showBanner() {
3030
console.log(text);
3131
console.log(chalk.hex(BANNER_COLOR)(TAGLINE));
3232
console.log(chalk.hex(BANNER_COLOR)(`v${getVersion()}`));
33+
if (process.env.JUST_SCRAPE_API_URL) {
34+
console.log(chalk.yellow(`→ Custom API: ${process.env.JUST_SCRAPE_API_URL}`));
35+
}
3336
console.log();
3437
}

0 commit comments

Comments
 (0)