MCPcopy Index your code
hub / github.com/thesysdev/openui / writeCloudEnv

Function writeCloudEnv

packages/openui-cli/src/commands/create-app.ts:172–199  ·  view source on GitHub ↗
(
  targetDir: string,
  name: string,
  options: CreateAppOptions,
  interactive: boolean,
)

Source from the content-addressed store, hash-verified

170}
171
172async function writeCloudEnv(
173 targetDir: string,
174 name: string,
175 options: CreateAppOptions,
176 interactive: boolean,
177): Promise<boolean> {
178 let apiKey: string | null = null;
179 try {
180 const resolved = await resolveCloudApiKey({
181 apiKey: options.apiKey,
182 auth: options.auth,
183 projectName: name,
184 interactive,
185 });
186 apiKey = resolved.key;
187 telemetry.capture("cli_cloud_auth_method", {
188 method: resolved.method,
189 succeeded: apiKey != null,
190 });
191 } catch (err) {
192 const msg = err instanceof Error ? err.message : String(err);
193 console.error(`\n⚠ Could not obtain an API key: ${msg}`);
194 console.error(` Add THESYS_API_KEY to .env later (keys: ${THESYS_KEYS_URL}).\n`);
195 }
196 const lines = [`THESYS_API_KEY=${apiKey ?? ""}`, `DEMO_USER_ID=demo-user`];
197 fs.writeFileSync(path.join(targetDir, ".env"), lines.join("\n") + "\n");
198 return apiKey != null;
199}
200
201function getStartedMessage(o: {
202 name: string;

Callers 1

runCreateAppFunction · 0.85

Calls 2

resolveCloudApiKeyFunction · 0.90
captureMethod · 0.80

Tested by

no test coverage detected