summaryrefslogtreecommitdiff
path: root/internal/hexailsp
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-08-17 21:39:01 +0300
committerPaul Buetow <paul@buetow.org>2025-08-17 21:39:01 +0300
commitad99f0a6a65bb1d327feb933d5349fc067c881f2 (patch)
treef8e66b81639e134e4898e000ff34e8782db57fa0 /internal/hexailsp
parent454451105ad3522d2ac3d22136eedee4a4d034af (diff)
feat: Support XDG config home
This change implements support for the XDG Base Directory Specification for the configuration file. The configuration file is now read from `$XDG_CONFIG_HOME/hexai/config.json` if the `XDG_CONFIG_HOME` environment variable is set. If it is not set, it falls back to the previous location, `$HOME/.config/hexai/config.json`. This change also includes: - A fix for a bug in the test suite where a test was failing due to an environment variable being set. - Updates to the documentation to reflect the new configuration file location. - A version bump to 0.1.0.
Diffstat (limited to 'internal/hexailsp')
-rw-r--r--internal/hexailsp/run_test.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/internal/hexailsp/run_test.go b/internal/hexailsp/run_test.go
index 2c0fcaf..923f408 100644
--- a/internal/hexailsp/run_test.go
+++ b/internal/hexailsp/run_test.go
@@ -24,6 +24,10 @@ type fakeServer struct{
func (f *fakeServer) Run() error { f.ran = true; return nil }
func TestRunWithFactory_UsesDefaultsAndCallsServer(t *testing.T) {
+ old := os.Getenv("OPENAI_API_KEY")
+ t.Cleanup(func(){ _ = os.Setenv("OPENAI_API_KEY", old) })
+ _ = os.Setenv("OPENAI_API_KEY", "")
+
var stderr bytes.Buffer
logger := log.New(&stderr, "hexai-lsp ", 0)
cfg := appconfig.Load(nil) // defaults