MCPcopy Create free account
hub / github.com/ForestHubAI/edge-agents / envFile

Function envFile

ts/workflow-cli/cli/deploy/generate.ts:154–181  ·  view source on GitHub ↗
(cfg: DeployConfig)

Source from the content-addressed store, hash-verified

152// document (<name>-secrets.json). This file carries only non-secret runtime knobs
153// plus the web-search key (engine-wide device env, not a per-resource secret).
154export function envFile(cfg: DeployConfig): string {
155 // Only present when the workflow has a WebSearchTool node (cfg.webSearch set).
156 const webSearchSection = cfg.webSearch
157 ? `# ----- Web search -----
158ENGINE_WEB_SEARCH_PROVIDER=${cfg.webSearch.provider}
159ENGINE_WEB_SEARCH_API_KEY=${cfg.webSearch.apiKey}
160
161`
162 : "";
163
164 return `# Edge Agents engine — operator configuration.
165# Auto-generated by \`fh-workflow deploy\`. Loaded into the engine via the compose
166# \`env_file\`. Secret values: chmod 600 this file after editing.
167
168${webSearchSection}# ----- Runtime -----
169ENGINE_LOG_LEVEL=${cfg.logLevel} # debug | info | warn | error
170`;
171}
172
173// Exported for testing purposes only.
174export function readme(spec: DeploymentSpec, cfg: DeployConfig, hasProviderModel: boolean, hasSecrets = false): string {
175 const localProviders = Object.keys(cfg.llmKeys).filter((id) => Boolean(cfg.llmKeys[id]));
176 const providerBlock =
177 localProviders.length === 0
178 ? "_No provider keys set._ An Agent that uses a catalog model will fail at build — supply the matching provider key at deploy."
179 : localProviders.map((id) => `- **${id}** — runs locally (your API key, in \`engine-secrets.json\`)`).join("\n");
180
181 const engine = spec.components.find((c) => c.name === "engine");
182 const hasHardware = (engine?.devices?.length ?? 0) > 0 || Boolean(engine?.privileged);
183 // All on-device models share ONE llama server; their GGUFs live together in that
184 // component's workspace dir (./workspaces/llama/) — the host bind mount the

Callers 2

writeOutputFunction · 0.90
generate.test.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected