Packages / nuxt-ops
Configuration
Every option of the module, the environment variable behind it, and the runtime config it writes.
Options go under ops in nuxt.config.ts. Each one also reads an environment variable,
so a build can be configured without touching the file.
| option | variable | default | what it is |
|---|---|---|---|
url | OPS_PUBLIC_URL | empty | the address the browser calls for the status banner |
buildUrl | OPS_URL | url | the address the build calls for translations |
project | OPS_PROJECT | empty | your project's slug |
environment | OPS_ENVIRONMENT | development | the environment's name |
bundle | OPS_TMS_BUNDLE | the one named like the project | which of the project's own translation bundles the pull starts from |
platform | OPS_TMS_PLATFORM | empty | pull one translation bundle as it is instead, see Translations |
localesDir | i18n/locales | the locale directory, relative to the app's root | |
tms | true | false switches the build time pull off | |
banner | true | false leaves out <OpsStatusBanner> and useOpsStatus() |
OPS_API_TOKEN has no option on purpose: it is the build's credential for the
translation pull and belongs in the build's environment only.
Runtime config
The module writes three public keys:
useRuntimeConfig().public.ops // { url, project, environment }
Because the keys are declared, Nuxt lets you override them when the server starts, after
the build, with NUXT_PUBLIC_OPS_URL, NUXT_PUBLIC_OPS_PROJECT and
NUXT_PUBLIC_OPS_ENVIRONMENT. One image can then serve staging and production.
A value you set yourself in runtimeConfig.public.ops wins over the module's.
What it never carries
Everything in runtimeConfig.public is sent to every browser. Never put a database
address, a token or any other secret there. A Database resource writes its connection into
the service's secret group; read it on the server from process.env, or from a private
runtimeConfig key overridden by NUXT_<KEY>.
The module does not fetch secrets at build time either. A build that held an ops token for
secrets would make that token mandatory for every build; use ops env pull on your
machine instead.