fimo 2.9.0-staging.3 → 2.9.0-staging.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/skills/fimo-cli/SKILL.md +1 -1
- package/assets/skills/fimo-cli/references/deploy.md +2 -2
- package/assets/skills/fimo-cli/references/project-vars-and-secrets.md +32 -10
- package/assets/skills/fimo-studio/SKILL.md +3 -1
- package/assets/skills/fimo-studio/references/ai-chat.md +1 -1
- package/assets/skills/fimo-studio/references/variables-and-secrets.md +16 -0
- package/dist/build/vite/plugins/runtime-env.d.ts +5 -5
- package/dist/build/vite/plugins/runtime-env.js +30 -26
- package/dist/cli/bundle.json +1 -1
- package/dist/cli/index.js +7 -5
- package/package.json +8 -8
- package/templates/astro/package.json +3 -3
- package/templates/nextjs/package.json +4 -4
- package/templates/react-router/package.json +5 -5
- package/templates/sveltekit/package.json +3 -3
- package/templates/vite/package.json +5 -5
|
@@ -153,7 +153,7 @@ These fire at specific moments in the project lifecycle. **Surface them proactiv
|
|
|
153
153
|
- **Bare `fimo init` in a non-interactive shell** — will hang. Always pass `[dir]`, `--no-install` (or `--install`), `--no-skills` (or `--skills`), and `--org`/`--agents` as needed explicitly when scripted.
|
|
154
154
|
- **Hardcoding content / strings / images in code, or committing image and video files** — that's what schemas, `t()`, and the media library are for. See the `fimo-code` skill's non-negotiable boundaries.
|
|
155
155
|
- **Adding another deploy tool**. Fimo handles deploys; don't bolt another platform on.
|
|
156
|
-
- **Committing secrets** —
|
|
156
|
+
- **Committing secrets or storing API keys as public variables** — server-side keys use `fimo vars add --private`; Fimo-only credentials use `fimo secrets`; public browser-safe values use `fimo vars`. Local env files are ignored and must not become deploy inputs.
|
|
157
157
|
- **Hardcoding tokens in flags** — use the credentials written by `fimo login` (one file per backend at `~/.config/fimo/credentials/<host>-<hash>.json`).
|
|
158
158
|
- **Treating the daily allowance as extra credits** — the allowance section appears only for legacy Premium organizations, and `fimo credits` already includes its spendable credits in "Available now"; it is accounting context, not an amount to add.
|
|
159
159
|
- **Trying to refill credits from the CLI** — `fimo credits` is read-only. Buying/refilling credits belongs in the billing UI for now.
|
|
@@ -22,7 +22,7 @@ fimo deploy -m "<commit message>" --publish # also publish a new live version
|
|
|
22
22
|
- **`fimo deploy`** — commits pending changes, pushes to the current Branch, syncs that Branch's preview sandbox, and links to Fimo Studio.
|
|
23
23
|
- **`fimo deploy --publish`** — same as above, then triggers a live publish and prints the live URL. Runs from the configured Production source Branch only. **Only use `--publish` when the user signals "ship it"** — first-time site completion, or an explicit "publish" / "go live" request. Otherwise stick to plain `fimo deploy`. (For a _versioned_ prod release, use `fimo publish` instead — see below.)
|
|
24
24
|
- **`-m`** is the commit message used when there are uncommitted local changes; required in non-interactive shells. Omit if the working tree is already clean.
|
|
25
|
-
- **`--no-restart`** — tells the sandbox to skip the dev-server restart and let Vite HMR pick up the change. Shaves ~3s per deploy. See "Skipping the dev-server restart" below for when it's safe.
|
|
25
|
+
- **`--no-restart`** — tells the sandbox to skip the dev-server restart and let Vite HMR pick up the change. Shaves ~3s per deploy. A deploy that carries changed variables restarts anyway. See "Skipping the dev-server restart" below for when it's safe.
|
|
26
26
|
|
|
27
27
|
## Reading deploy destinations
|
|
28
28
|
|
|
@@ -43,7 +43,7 @@ Read these fields from `data`:
|
|
|
43
43
|
|
|
44
44
|
When reporting the result, give the user `studio_url`. If a person or tool needs the hosted site itself, run `fimo preview url` after deploy.
|
|
45
45
|
|
|
46
|
-
Public
|
|
46
|
+
Public variables are injected into preview, build, and deploy runtimes. Private variables (`fimo vars add --private`) reach the site's server code at runtime in previews and production, never an env file or the browser bundle. Secrets are not injected into the site; agents request them separately through their own config. See `references/project-vars-and-secrets.md`.
|
|
47
47
|
|
|
48
48
|
## Diagnose a failed publication
|
|
49
49
|
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
# Project Variables And Secrets
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Three kinds of values, each set per Environment (production, preview, or a custom Environment):
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
- **Public variables** — safe to expose to the browser.
|
|
6
|
+
- **Private variables** — API keys and tokens the site's own server code reads. Write-only after saving.
|
|
7
|
+
- **Secrets** — credentials Fimo itself uses for webhooks, schedules, and agents. Never sent to the site.
|
|
6
8
|
|
|
7
9
|
## Public Variables
|
|
8
10
|
|
|
@@ -24,8 +26,29 @@ fimo vars pull .env.e2e
|
|
|
24
26
|
|
|
25
27
|
Fimo only edits the block between `# fimo:vars:start` and `# fimo:vars:end`. User-authored lines in the file stay untouched.
|
|
26
28
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
Public variables may use browser-safe prefixes such as `VITE_`, `PUBLIC_`, `NEXT_PUBLIC_`, or `NUXT_PUBLIC_`.
|
|
30
|
+
|
|
31
|
+
## Private Variables
|
|
32
|
+
|
|
33
|
+
Use a private variable for any key the site's server code needs: payment, email, search admin, or database credentials.
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
fimo vars add STRIPE_SECRET_KEY --private --stdin
|
|
37
|
+
fimo vars update STRIPE_SECRET_KEY --stdin
|
|
38
|
+
fimo vars unset STRIPE_SECRET_KEY
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
- The value is never shown again; `fimo vars list` masks it.
|
|
42
|
+
- `fimo vars pull` never writes the value. For each private key not already set in the file, it writes a comment inside the managed block: `# STRIPE_SECRET_KEY is a private variable: add a local value outside this block`. When you see one, ask the user for a local test value (never the production one) and add `STRIPE_SECRET_KEY=...` to `.env.local` **outside** the `# fimo:vars:start` / `# fimo:vars:end` block, where `fimo vars pull` will not overwrite it. Do not paste a value into the managed block; the next pull removes it.
|
|
43
|
+
- If the user has no local value, local server code reading the key gets `undefined`. Previews and production still get the stored value.
|
|
44
|
+
- The site's server code reads it as `process.env.STRIPE_SECRET_KEY` in the Studio preview, hosted previews, production and schedule runs. Fimo never writes it to an env file or the browser bundle.
|
|
45
|
+
- Fimo agents' shell commands do not receive private values, and output that would show one is redacted. Test a server route through the preview instead of reading the key from a shell.
|
|
46
|
+
- A dev server whose Environment is Production never gets production private values.
|
|
47
|
+
- Private variables cannot use browser prefixes (`VITE_`, `PUBLIC_`, `NEXT_PUBLIC_`, `NUXT_PUBLIC_`). Read them only from server code.
|
|
48
|
+
- Set one value per Environment: a test key for preview, the live key for production.
|
|
49
|
+
- Public or private is chosen when the variable is created. To switch, unset it and add it again.
|
|
50
|
+
- A changed or removed variable applies on the next deploy: run `fimo deploy` for previews (with no new commit, it restarts the preview and rebuilds the hosted preview when variables changed) and `fimo publish` for the live site. After changing variables for the user, offer that redeploy.
|
|
51
|
+
- Names that control processes (`PATH`, `NODE_ENV`, `NODE_OPTIONS`, `HTTPS_PROXY`, `GIT_*`, `NPM_CONFIG_*` and similar) are refused for new private variables, and a public variable with such a name never reaches the site's processes or the `.env.local` written by `fimo vars pull`.
|
|
29
52
|
|
|
30
53
|
## Secrets
|
|
31
54
|
|
|
@@ -40,10 +63,7 @@ fimo secrets unset FIRECRAWL_API_KEY
|
|
|
40
63
|
Secret values are hidden after write. Listing secrets shows the key and a masked value, never the plaintext.
|
|
41
64
|
`fimo secrets add` refuses to replace an existing value. Use `fimo secrets update` for an intentional rotation.
|
|
42
65
|
|
|
43
|
-
Secrets are
|
|
44
|
-
or generated project files. Secrets cannot use public prefixes such as `VITE_`,
|
|
45
|
-
`PUBLIC_`, `NEXT_PUBLIC_`, or `NUXT_PUBLIC_`; those prefixes are for public
|
|
46
|
-
variables.
|
|
66
|
+
Secrets are for Fimo itself: webhook headers, schedule runs, and agents. They are never sent to the site, its builds, or its env files. Secrets cannot use public prefixes such as `VITE_`, `PUBLIC_`, `NEXT_PUBLIC_`, or `NUXT_PUBLIC_`.
|
|
47
67
|
|
|
48
68
|
## Local Env Files
|
|
49
69
|
|
|
@@ -57,5 +77,7 @@ Local env files are ignored by git in Fimo sites. They are for local development
|
|
|
57
77
|
|
|
58
78
|
## Choosing Between Them
|
|
59
79
|
|
|
60
|
-
-
|
|
61
|
-
-
|
|
80
|
+
- Safe to show in browser code or page source: `fimo vars add`.
|
|
81
|
+
- An API key the site's server code calls with: `fimo vars add --private`.
|
|
82
|
+
- A credential only a webhook, schedule, or agent uses: `fimo secrets add`.
|
|
83
|
+
- Never store an API key as a public variable.
|
|
@@ -36,7 +36,7 @@ Use plain, friendly language. Describe what users see, where they click, and wha
|
|
|
36
36
|
|
|
37
37
|
- **Header (desktop):** the site menu (site name; History is here) and the Branch switcher, then the workspaces: Chats, Getting started, Preview, Content, Assets, Analytics, Settings. Only workspaces the user can access appear. Workspaces that do not fit move into **More**. On the right: Earn free credits, Invite, Clone, Publish, and Merge on a Branch.
|
|
38
38
|
- **Phone:** bottom tabs for Chat, Preview and Settings. Invite, Earn free credits and Clone ("Work on this site locally") move into the site menu.
|
|
39
|
-
- **Settings:** General, Domains, Knowledge, SEO and Languages are listed directly. Models, Environments, Secrets, Schedules, Webhooks and Connections are under **Advanced settings**.
|
|
39
|
+
- **Settings:** General, Domains, Knowledge, SEO and Languages are listed directly. Models, Environments, Variables, Secrets, Schedules, Webhooks and Connections are under **Advanced settings**.
|
|
40
40
|
- **Shortcuts:** Alt+1 Preview, Alt+2 Content, Alt+3 Assets, Alt+5 Settings, Alt+E edit mode, Cmd/Ctrl+K command palette.
|
|
41
41
|
|
|
42
42
|
When a reference says "open X", X can be inside **More** on a narrow window.
|
|
@@ -56,6 +56,7 @@ Read the relevant reference file when the user's question matches a topic.
|
|
|
56
56
|
| AI Chat | references/ai-chat.md | "What can the AI do?", "How do I give context?" |
|
|
57
57
|
| Site Knowledge | references/knowledge.md | "Set brand guidance", "Website goals", "Draft knowledge from the site" |
|
|
58
58
|
| SEO Settings | references/seo-settings.md | "How do I set up SEO?", "Favicon, title, share image" |
|
|
59
|
+
| Variables & Secrets | references/variables-and-secrets.md | "Where do I put an API key?", "Public or private variable?" |
|
|
59
60
|
| Schedules | references/schedules.md | "Recurring commands", "Run history", "Run now" |
|
|
60
61
|
| Webhooks | references/webhooks.md | "React to forms", "Send events to another service" |
|
|
61
62
|
| Connections | references/connections.md | "Connect a service", "Add an MCP server" |
|
|
@@ -77,6 +78,7 @@ Read the relevant reference file when the user's question matches a topic.
|
|
|
77
78
|
| Webhooks | Site secrets, Forms, Publishing |
|
|
78
79
|
| Connections | AI Chat, Site secrets |
|
|
79
80
|
| Schedules | Site secrets, Environments |
|
|
81
|
+
| API keys | Variables (private), Site secrets |
|
|
80
82
|
| Visual changes | Edit Mode (CMS content), AI Chat (layout, styling, and code changes) |
|
|
81
83
|
| Something went wrong | Version History, AI Chat |
|
|
82
84
|
| Working with others | Sharing, Collaboration |
|
|
@@ -10,7 +10,7 @@ Chat has its own **Chats** tab in the site header; the tab shows how many chats
|
|
|
10
10
|
|
|
11
11
|
Agents and routines appear only when the organization has the agents feature, which is off by default in production. Without it, the **+** above the chat list opens a new chat directly, agent settings have no **Routines**, and existing routines do not run; ask Fimo support to enable it. The plan decides the agents (FIMO-2856): Free has the SEO and GEO default agents, each running only its weekly checkup (**Weekly SEO checkup**, **Weekly AI check**), and its agent settings list the routines Starter adds with **See plans**; Starter (pay-as-you-go) has every default agent with its detailed routines, and a change wakes each routine at most once a day (the changes made meanwhile wait and the next run, a day after the last one started, checks them together; the routine's next run shows when, and **Run now** and schedules never wait); Pro runs them right after each change and adds agents of one's own (**New agent**). In the **+** menu, what the plan does not include shows **Upgrade** and opens the plans. Default agents are Fimo's: their routines follow Fimo's instructions, only switch off and on or get deleted (a deleted one stays deleted), and nothing is added to them (`routine_is_default`); routines of one's own live in a custom agent, on Pro (`routine_needs_pro` below Pro). A default agent's name, description and portrait cannot be changed on any plan, and a custom agent's change only on Pro: below Pro its settings are read-only, say its routines are paused and offer **See plans**, and it can still be deleted. A plan change changes which agents open and which routines run; agents, routines and past runs stay. Fimo support can give an organization Pro's agents on any plan. A routine Fimo retires from a default agent stops running and leaves the list.
|
|
12
12
|
|
|
13
|
-
An agent is a chat with a job: a name and a description that Fimo reads at the start of every reply in that chat. Agents are shared like any chat and are listed as soon as they are created, with an **Agent** tag after the name. The **+** above the chat list is a menu: **New chat** (blank), **New agent** (a name and a description, then the empty agent opens), and under **Agents** Fimo's default agents (**SEO**, **GEO**, **Content**, **Quality**, **Compliance**); a new site starts with SEO and GEO listed, their routines active from the start; Content, Quality and Compliance, and every default on an older site, are created the first time someone selects them, routines active, the same chat every time after. In an agent, the
|
|
13
|
+
An agent is a chat with a job: a name and a description that Fimo reads at the start of every reply in that chat. Agents are shared like any chat and are listed as soon as they are created, with an **Agent** tag after the name. The **+** above the chat list is a menu: **New chat** (blank), **New agent** (a name and a description, then the empty agent opens), and under **Agents** Fimo's default agents (**SEO**, **GEO**, **Content**, **Quality**, **Compliance**); a new site starts with SEO and GEO listed, their routines active from the start; Content, Quality and Compliance, and every default on an older site, are created the first time someone selects them, routines active, the same chat every time after. In an agent, the header shows the name alone and the empty state introduces the agent by name and job (the description's first three lines); a cut description shows whole on hover, or on tap on a phone, and the message box reads **Message <name>**. The agent's settings page has a **Description** field, shared with everyone; empty means none. The filter icon's **Kind** option shows only chats or only agents; search finds an agent by its name.
|
|
14
14
|
|
|
15
15
|
The **SEO** default runs six routines backed by Studio's built-in `fimo-seo` skill, which checks the site as a browser renders it and fixes at the source: **Technical SEO** (status, redirects, canonicals, sitemap, robots.txt, language, main heading, and changes since its last run: pages moved without a redirect), **Broken links**, **Meta tags** (titles, descriptions, Open Graph, the site's title ending, length in characters and pixels), **Image SEO** (alt text, file names, images over 200 KB: one in the media library or the site's own files is rendered through Fimo's resizing on its own, a file of the site uploaded first), **Hreflang** (only on a site in more than one language) and **Internal linking** (orphan and deep pages, articles with no link up to a hub or product page or more than eight links). Each default routine wakes on the changes on main that can matter to it, before a publish (CMS edits, code changes, images, languages, forms; the first publish and a new domain for Technical SEO and Cookie consent): a small model reads each change first, so a quiet site runs nothing, and the run checks what changed (the whole site on its first run). Only what changes without anyone touching the site keeps a schedule: Broken links checks outbound links on the 1st of every month, Content refresh runs on the 2nd, Content lifecycle every three months, Privacy and legal pages once a year. A page it changed is left alone for 8 weeks, the time Google takes to show the effect. A fix with one right answer from the page's own words is made without a message (a link only once the new target is checked to be the same content in the same language; a link on words the text already uses to name another page; a 301 from a page's old address once the same page is live at a new one); a change to what visitors read, which page wins a search, whether a page exists, a redirect with more than one possible target, a price or a legal page is asked as a decision; page removals and the robots policy are never changed on its own. A change a person asks for in a chat is made. What a check could not tell (a timeout, a 5xx, a page past the crawl limit) is never acted on: the run retries once, then says the check was incomplete.
|
|
16
16
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Variables and secrets
|
|
2
|
+
|
|
3
|
+
Both live under **Settings → Advanced settings**. Only members with Full Access can add, change, or remove them. Each value belongs to one Environment (Production, Preview, or a custom Environment), so preview can use test keys and production the live ones.
|
|
4
|
+
|
|
5
|
+
## Variables
|
|
6
|
+
|
|
7
|
+
Open **Variables**, then **Add variable**. Pick the Environment, enter an uppercase key such as `STRIPE_SECRET_KEY`, enter the value, and choose:
|
|
8
|
+
|
|
9
|
+
- **Public** (default): the value stays visible and can be used in browser code with a `VITE_`, `PUBLIC_`, `NEXT_PUBLIC_`, or `NUXT_PUBLIC_` key. Use it for a site URL or a search-only key.
|
|
10
|
+
- **Private**: the value is hidden for good and only the site's server code can read it. Use it for payment, email, or database keys. Private keys cannot use the browser prefixes above.
|
|
11
|
+
|
|
12
|
+
Agents working on the site do not get private values in their own commands. Public or private is fixed once saved. To switch, delete the variable and add it again. Use the row menu to change a value or delete it. Changes reach previews on the next deploy, even with no code change, and the live site on the next publish.
|
|
13
|
+
|
|
14
|
+
## Secrets
|
|
15
|
+
|
|
16
|
+
Open **Secrets** for credentials Fimo itself uses: webhook headers, schedules, and agents. The site never receives them. If the site's code needs the key, use a private variable instead.
|
|
@@ -11,11 +11,11 @@ import type { Plugin } from 'vite';
|
|
|
11
11
|
* Two injection paths, both needed:
|
|
12
12
|
* - `process.env`, so Vite's own `VITE_*` exposure, `loadEnv`, and server-side
|
|
13
13
|
* code (`getFimoPaths`, SSR) all see the value.
|
|
14
|
-
* - `define` for the
|
|
15
|
-
* `define`s them from `loadEnv` at user-config time — before
|
|
16
|
-
* run — which yields `undefined` on a bare checkout; a
|
|
17
|
-
* merges over the user's, so this is what makes the client
|
|
18
|
-
* URL.
|
|
14
|
+
* - `define` for the public runtime keys, explicit or derived. Fimo's own
|
|
15
|
+
* template `define`s two of them from `loadEnv` at user-config time — before
|
|
16
|
+
* any plugin can run — which yields `undefined` on a bare checkout; a
|
|
17
|
+
* plugin's `define` merges over the user's, so this is what makes the client
|
|
18
|
+
* see the URL. Never over a non-empty user `define`, which stays
|
|
19
19
|
* authoritative.
|
|
20
20
|
*/
|
|
21
21
|
export default function runtimeEnvPlugin(): Plugin;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { resolveFimoEditingMetadata } from '../../../runtime/preview/editing-metadata.js';
|
|
2
|
+
import { LOCAL_CONTENT_API_ENV_KEYS, LOCAL_ENV_SELECTOR_KEYS } from '../../../runtime/shared/branch-identity.js';
|
|
2
3
|
import { findStaleFimoOverride, resolveLocalRuntimeEnv, staleOverrideMessage, } from '../../../runtime/shared/local-runtime-env.js';
|
|
3
4
|
/**
|
|
4
5
|
* Point the app at the Fimo env of the current git branch.
|
|
@@ -12,11 +13,11 @@ import { findStaleFimoOverride, resolveLocalRuntimeEnv, staleOverrideMessage, }
|
|
|
12
13
|
* Two injection paths, both needed:
|
|
13
14
|
* - `process.env`, so Vite's own `VITE_*` exposure, `loadEnv`, and server-side
|
|
14
15
|
* code (`getFimoPaths`, SSR) all see the value.
|
|
15
|
-
* - `define` for the
|
|
16
|
-
* `define`s them from `loadEnv` at user-config time — before
|
|
17
|
-
* run — which yields `undefined` on a bare checkout; a
|
|
18
|
-
* merges over the user's, so this is what makes the client
|
|
19
|
-
* URL.
|
|
16
|
+
* - `define` for the public runtime keys, explicit or derived. Fimo's own
|
|
17
|
+
* template `define`s two of them from `loadEnv` at user-config time — before
|
|
18
|
+
* any plugin can run — which yields `undefined` on a bare checkout; a
|
|
19
|
+
* plugin's `define` merges over the user's, so this is what makes the client
|
|
20
|
+
* see the URL. Never over a non-empty user `define`, which stays
|
|
20
21
|
* authoritative.
|
|
21
22
|
*/
|
|
22
23
|
export default function runtimeEnvPlugin() {
|
|
@@ -49,34 +50,37 @@ export default function runtimeEnvPlugin() {
|
|
|
49
50
|
? 'development'
|
|
50
51
|
: 'production', explicit.FIMO_EDITING_METADATA))),
|
|
51
52
|
};
|
|
52
|
-
if (
|
|
53
|
-
return { define, ssr };
|
|
54
|
-
}
|
|
55
|
-
if (command === 'serve') {
|
|
53
|
+
if (derived && command === 'serve') {
|
|
56
54
|
const stale = findStaleFimoOverride(explicit, derived);
|
|
57
55
|
if (stale) {
|
|
58
56
|
console.warn(staleOverrideMessage(stale));
|
|
59
57
|
}
|
|
60
58
|
}
|
|
61
|
-
//
|
|
62
|
-
//
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
59
|
+
// `define` every public runtime key, explicit or derived, on every
|
|
60
|
+
// config pass. Vite only exposes `envPrefix` matches on
|
|
61
|
+
// `import.meta.env`, so an unprefixed key reaches code that reads
|
|
62
|
+
// `import.meta.env` — Astro's server runtime reads `FIMO_CONTENT_API_URL`
|
|
63
|
+
// and `FIMO_ENV` there — only through a `define` or the framework's own
|
|
64
|
+
// env plugin. Astro's dev plugin caches those values per instance, and
|
|
65
|
+
// Vite's `.env` restart reuses the instance: a forked preview whose host
|
|
66
|
+
// rewrote `.env` for its Branch kept requesting the parent's (FIMO-2902).
|
|
67
|
+
// This hook reruns on that restart, so its `define` carries the new
|
|
68
|
+
// values. Only this allowlist is defined: every value is a public
|
|
69
|
+
// tenant URL or a Branch name, never an arbitrary `FIMO_*` secret.
|
|
70
|
+
for (const key of [...LOCAL_CONTENT_API_ENV_KEYS, ...LOCAL_ENV_SELECTOR_KEYS]) {
|
|
67
71
|
const defined = config.define?.[`import.meta.env.${key}`];
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
+
if (defined !== undefined && defined !== 'undefined' && defined !== JSON.stringify('')) {
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
const value = explicit[key] || derived?.values[key];
|
|
76
|
+
if (!value) {
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
if (!explicit[key]) {
|
|
80
|
+
process.env[key] = value;
|
|
81
|
+
}
|
|
82
|
+
define[`import.meta.env.${key}`] = JSON.stringify(value);
|
|
72
83
|
}
|
|
73
|
-
// `define` EVERY derived key, not a hand-picked subset. Vite only exposes
|
|
74
|
-
// `envPrefix` matches on `import.meta.env`, so an unprefixed key set on
|
|
75
|
-
// `process.env` is invisible to code that reads `import.meta.env` — which
|
|
76
|
-
// is how Astro's server runtime reads `FIMO_CONTENT_API_URL`. A curated
|
|
77
|
-
// list silently misses whichever framework reads a key that is not on it.
|
|
78
|
-
// Every value here is a public tenant URL or an env name; none is secret.
|
|
79
|
-
Object.assign(define, Object.fromEntries(missing.map(([key, value]) => [`import.meta.env.${key}`, JSON.stringify(value)])));
|
|
80
84
|
return { define, ssr };
|
|
81
85
|
},
|
|
82
86
|
},
|