openwork icon indicating copy to clipboard operation
openwork copied to clipboard

[Feature] Add a UI for managing environment variables

Open mbhassan opened this issue 7 months ago • 7 comments

Summary

Provide a settings screen where users can define and persist environment variables (API keys, endpoints, etc.) directly in the app, removing the need to edit shell config files or use gtk-launch workarounds.

Problem / goal

Environment variables must currently be set in .bashrc or similar, and the app must be launched via gtk-launch from a terminal for those vars to be inherited. This is invisible friction that causes silent failures and is inaccessible to non-technical users.

Primary user(s)

  • [x] Bob (IT / power user)
  • [x] Susan (non-technical)
  • [ ] Other team roles

OpenCode primitive alignment

session.* (env vars feed into model provider config and tool auth), mcp (MCP server tokens/keys), skills/plugins (skill-level env overrides)

Alignment with VISION/PRINCIPLES/PRODUCT

Making the app self-contained and configurable through its own UI, without terminal knowledge, directly supports the product's goal of being accessible to non-technical team members (Susan persona). It also prevents the common silent-failure scenario where the app starts without required keys.

Testability

pnpm dev + open Settings > Environment Variables + add a key/value pair + restart session + verify the variable is available in a tool call or model request

Ready to build it yourself?

Yes

Additional context

Suggested behaviour:

  • Key/value editor in Settings UI
  • Values persisted to a local config file (e.g. ~/.config/openwork/env)
  • Injected into the app process at startup
  • Sensitive values masked (shown as ••••••) with a reveal toggle

This removes the need for gtk-launch or any shell-level workarounds for GUI users.

mbhassan avatar Apr 12 '26 08:04 mbhassan

@src-opn can you take a look at this? Just had a chat with him this morning. It's for self-deployment.

jcllobet avatar Apr 13 '26 18:04 jcllobet

@mbhassan can you share what kind of env vars you';re wanting to save in the app? are these env vars so that agents can consume them when making api calls to other tools? or are these env vars for building and running the app?

src-opn avatar Apr 13 '26 18:04 src-opn

@src-opn sure. Things like API_KEYS, GCLOUD, GCP_* var amongst others needed for the various LLM providers.

The current workaround I had found was running the application using gtk-launch to ensure that the env var set in .bashrc are the ones loaded in as well.

And a maybe/no on the agent use. Dont want the agents exposing keys upon inquiry when deployed at enterprises.

mbhassan avatar Apr 13 '26 18:04 mbhassan

@mbhassan have you seen/tried our cloud LLM Providers system? It allows you to set provider config, and then "push" it to users signed in to the org

Otherwise, for things like MCP keys etc, we will be adding a similar cloud system to LLM Providers that will allow push config

src-opn avatar Apr 13 '26 19:04 src-opn

@src-opn nope not yet. Will try it out

mbhassan avatar Apr 13 '26 19:04 mbhassan

@mbhassan here's a link to a tutorial I recorded last week covering some of the features. For what you're trying to do, you could setup one organization with RBAC and invite external users as an individual team (or set up separate orgs for each different company) https://www.youtube.com/watch?v=R6pSNag_lCw

jcllobet avatar Apr 13 '26 21:04 jcllobet

@mbhassan @jcllobet I created a PR specifically for this #1548 It allows you to add your GOOGLE_API_KEY for Nano Banana, 11Labs for voice etc.; a useful and safe feature. User can define more flexible workflow with this.

shizhigu avatar Apr 26 '26 08:04 shizhigu