Skip to content

Open source AI coding agent. Designed for large projects and real world tasks.

Update Env vars

knno8ef7c98ba406
diff --git a/.gitignore b/.gitignore
index b2c82dc4..e71cfb9c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@
.envkey
plandex
plandex-server
+*.exe
node_modules/
/tools/
/static/
diff --git a/README.md b/README.md
index 155d8ef4..8235aa22 100644
--- a/README.md
+++ b/README.md
@@ -72,7 +72,7 @@
📑  Manage context efficiently in the terminal. Easily add files or entire directories to context, and keep them updated automatically as you work so that models always have the latest state of your project.
-🧠  Plandex relies on the OpenAI API and requires an `OPENAI_API_KEY` environment variable. Support for open source models, Google Gemini, and Anthropic Claude is coming soon. Use the `OPENAI_ENDPOINT` environment variable for a custom OpenAI endpoint.
+🧠  Plandex relies on the OpenAI API and requires an `OPENAI_API_KEY` environment variable. Support for open source models, Google Gemini, and Anthropic Claude is coming soon. Use the `OPENAI_API_BASE` environment variable for a custom OpenAI endpoint.
✅  Plandex supports Mac, Linux, FreeBSD, and Windows. It runs from a single binary with no dependencies.
@@ -122,7 +122,7 @@ Then [generate an API key here.](https://platform.openai.com/account/api-keys)
```bash
cd your-project
export OPENAI_API_KEY=...
-export OPENAI_ENDPOINT=... # optional e.g. https://<your-proxy>/v1
+export OPENAI_API_BASE=... # optional e.g. https://<your-proxy>/v1
export OPENAI_ORG_ID=... # optional - set the OrgID if you have multiple OpenAI orgs
plandex new
```
diff --git a/app/cli/api/clients.go b/app/cli/api/clients.go
index 0167a4d5..2f03597b 100644
--- a/app/cli/api/clients.go
+++ b/app/cli/api/clients.go
@@ -21,7 +21,10 @@ var Client types.ApiClient = (*Api)(nil)
func init() {
if os.Getenv("PLANDEX_ENV") == "development" {
- cloudApiHost = "http://localhost:8088"
+ cloudApiHost = os.Getenv("PLANDEX_API_HOST")
+ if cloudApiHost == "" {
+ cloudApiHost = "http://localhost:8080"
+ }
} else {
cloudApiHost = "https://api.plandex.ai"
}
diff --git a/app/cli/dev.sh b/app/cli/dev.sh
index 14244d06..51137c78 100755
--- a/app/cli/dev.sh
+++ b/app/cli/dev.sh
@@ -1,7 +1,9 @@
#!/bin/bash
+OUT="${PLANDEX_OUT_DIR:-/usr/local/bin}"
+
go build && \
-rm -f /usr/local/bin/plandex && \
-cp plandex /usr/local/bin/plandex && \
-ln -sf /usr/local/bin/plandex /usr/local/bin/pdx && \
-echo built 'plandex' cli and added 'pdx' alias to /usr/local/bin
\ No newline at end of file
+rm -f $OUT/plandex && \
+cp plandex $OUT/plandex && \
+ln -sf $OUT/plandex $OUT/pdx && \
+echo built 'plandex' cli and added 'pdx' alias to $OUT
diff --git a/app/cli/plan_exec/build.go b/app/cli/plan_exec/build.go
index 36f0b018..8aaa512c 100644
--- a/app/cli/plan_exec/build.go
+++ b/app/cli/plan_exec/build.go
@@ -40,7 +40,7 @@ func Build(params ExecParams, buildBg bool) (bool, error) {
ConnectStream: !buildBg,
ProjectPaths: paths.ActivePaths,
ApiKey: os.Getenv("OPENAI_API_KEY"),
- Endpoint: os.Getenv("OPENAI_ENDPOINT"),
+ Endpoint: os.Getenv("OPENAI_API_BASE"),
OpenAIOrgId: os.Getenv("OPENAI_ORG_ID"),
}, stream.OnStreamPlan)
diff --git a/app/cli/plan_exec/tell.go b/app/cli/plan_exec/tell.go
index 25b43b69..2ba0df4c 100644
--- a/app/cli/plan_exec/tell.go
+++ b/app/cli/plan_exec/tell.go
@@ -71,7 +71,7 @@ func TellPlan(
BuildMode: buildMode,
IsUserContinue: isUserContinue,
ApiKey: os.Getenv("OPENAI_API_KEY"),
- Endpoint: os.Getenv("OPENAI_ENDPOINT"),
+ Endpoint: os.Getenv("OPENAI_API_BASE"),
OpenAIOrgId: os.Getenv("OPENAI_ORG_ID"),
}, stream.OnStreamPlan)
diff --git a/app/server/main.go b/app/server/main.go
index cbd6caf4..6bcb1658 100644
--- a/app/server/main.go
+++ b/app/server/main.go
@@ -35,10 +35,10 @@ func main() {
log.Println("In development mode.")
}
- // Get externalPort from the environment variable or default to 8088
+ // Get externalPort from the environment variable or default to 8080
externalPort := os.Getenv("PORT")
if externalPort == "" {
- externalPort = "8088"
+ externalPort = "8080"
}
go startServer(externalPort, routes())
diff --git a/guides/DEVELOPMENT.md b/guides/DEVELOPMENT.md
index 09cb7249..0050436b 100644
--- a/guides/DEVELOPMENT.md
+++ b/guides/DEVELOPMENT.md
@@ -35,8 +35,8 @@ Now from the root directory of this repo, run:
This creates watchers with `reflex` to rebuild both the server and the CLI when relevant files change.
-The server runs on port 8088 by default.
+The server runs on port 8080 by default.
-After each build, the CLI is copied to `/usr/local/bin/plandex` so you can use it with just `plandex` in any directory. A `pdx` alias is also created.
+After each build, the CLI is copied to `/usr/local/bin/plandex` (which can also be changed with the environment variable `PLANDEX_OUT_DIR`) so you can use it with just `plandex` in any directory. A `pdx` alias is also created.
When running the Plandex CLI, set `export PLANDEX_ENV=development` to run in development mode, which connects to the development server by default.
diff --git a/guides/ENVIRONMENT_VARS.md b/guides/ENVIRONMENT_VARS.md
new file mode 100644
index 00000000..409b2131
--- /dev/null
+++ b/guides/ENVIRONMENT_VARS.md
@@ -0,0 +1,38 @@
+
+# Environment Variables
+
+Here is a list of all the environment variables (and their defaults) that you can use with `plandex`.
+
+```bash
+# --- General ---
+
+OPENAI_API_BASE= # Your OpenAI server, such as http://localhost:1234/v1 Defaults to empty.
+OPENAI_API_KEY= # Your OpenAI key.
+
+# Plandex specific
+
+PLANDEX_DATA_DIR= # A directory to put plandex data files (cache etc.) to
+PLANDEX_ENV= # Set this to development in order to use custom API host. Defaults to empty.
+
+# Database
+PGDATA_DIR=/var/lib/postgresql/data
+DATABASE_URL=postgres://<user>:<password>@<host>:<port>/plandex?sslmode=disable
+# or
+PLANDEX_DB=plandex # Your postgres database.
+PLANDEX_USER= # Your postgres user.
+PLANDEX_PASSWORD= # Your postgres password.
+
+# --- Development variables (See DEVELOPMENT.md) ---
+
+PLANDEX_API_HOST= # Defaults to http://localhost:8080 if PLANDEX_ENV is development, otherwise it is http://api.plandex.ai
+PLANDEX_OUT_DIR=/usr/local/bin # The output when using dev.sh
+
+GOENV= # This should be set to development.
+GOPATH= # This should be already set to your go folder if you've installed Go lang.
+
+SMTP_HOST= # Youe SMTP host.
+SMTP_PORT= # Set this to 1025 e.g. if you are using mailhog.
+SMTP_USER= # SMTP username.
+SMTP_PASSWORD= # SMTP password.
+
+```
\ No newline at end of file
diff --git a/guides/USAGE.md b/guides/USAGE.md
index 19a7d839..4a4de17c 100644
--- a/guides/USAGE.md
+++ b/guides/USAGE.md
@@ -13,7 +13,7 @@ Support for more model providers is coming soon.
```bash
cd your-project
export OPENAI_API_KEY=...
-export OPENAI_ENDPOINT=... # optional e.g. https://<your-proxy>/v1
+export OPENAI_API_BASE=... # optional e.g. https://<your-proxy>/v1
export OPENAI_ORG_ID=... # optional - set the OrgID if you have multiple OpenAI orgs
plandex new
```