Commit4ea9997dRecorded20 Mar 2026Repositoryfjo

Load .env-fjo at startup for credential configuration

Changed
 README.md          | 14 ++++++++++++++
 src/fjo/config.sgl | 12 ++++++++++--
 src/fjo/main.sgl   |  1 +
 3 files changed, 25 insertions(+), 2 deletions(-)
Diff
README.mdmodified
@@ -31,6 +31,20 @@ Start with `fjo serve`. Exposes these tools:
31
32
## Configuration
33
+34
fjo reads a `.env-fjo` file from the working directory at startup if present.
+35
This is the standard convention for Sigil MCP servers — credentials live in a
+36
dotenv file rather than in the MCP server configuration.
+37
+38
Create a `.env-fjo` in your project root:
+39
+40
```
+41
FORGEJO_TOKEN=your-api-token-here
+42
FORGEJO_URL=https://codeberg.org
+43
```
+44
+45
Environment variables set through other means (shell export, MCP config) take
+46
precedence over the dotenv file.
+47
48
| Variable | Description | Default |
49
|----------|-------------|---------|
50
| `FORGEJO_TOKEN` | API token (required) | — |
src/fjo/config.sglmodified
@@ -1,15 +1,23 @@
1
;;; (fjo config) - Configuration management.
2
;;;
3
;;; Reads Forgejo credentials and instance URL from environment variables.
+4
;;; Call (fjo-load-env!) at startup to load .env-fjo from the working directory.
5
6
(define-library (fjo config)
7
(import (sigil core)
8
(sigil string)
8
(sigil process))
+9
(sigil process)
+10
(sigil env))
11
(export fjo-token
10
fjo-base-url)
+12
fjo-base-url
+13
fjo-load-env!)
14
(begin
15
+16
;;; Load .env-fjo from the working directory if present.
+17
(define (fjo-load-env!)
+18
(: -> void?)
+19
(load-env-file! ".env-fjo"))
+20
21
;;; Get the Forgejo API token.
22
;;;
23
;;; Raises an error if FORGEJO_TOKEN is not set.
src/fjo/main.sglmodified
@@ -161,6 +161,7 @@
161
;; ============================================================
162
163
(define (main)
+164
(fjo-load-env!)
165
(let ((args (cdr (command-line))))
166
(cond
167
((null? args)