`cf deploy` deletes plain-text vars set outside the config: no equivalent of `keep_vars`

Abierto
#197 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
65/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
typescript
Área
cli

Línea de trabajo

Start with the deploy command and the upload builder mentioned in the issue, then trace how worker configuration is read and how cf migrate handles keep_vars. Add a keepVars configuration or deploy flag that preserves externally managed plain-text vars, and ensure migration maps keep_vars; verify with the existing deploy and migration tests, if present.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

cf version: 1.0.0-beta.12

What happens

cloudflare.config.ts has no equivalent of Wrangler's keep_vars. cf migrate says so:

├─ [required] keep_vars: The keep_vars is not supported by the new config and was not migrated.
├─ [required] env.test.keep_vars: The keep_vars is not supported by the new config and was not migrated.

So after migrating, every cf deploy replaces the Worker's plain-text vars with what the config declares, and deletes any var set some other way: in the dashboard, over the API, or by another tool. In beta.12's dist, the upload builder takes keepVars, but the deploy command passes keepVars: void 0. cf deploy has no --var / --keep-vars flag either.

This is the vars half of #72, which covers secrets, where --secrets-file gives a workaround. Vars have no workaround.

Why it matters

Some projects deliberately keep runtime configuration as plain vars that are set outside the config file, so they stay readable on the Worker. In our case a separate operator tool writes them over the API, and the repo's wrangler.jsonc declares none of them, with keep_vars: true. With Wrangler, a deploy from a checkout ships code and leaves those values alone. With cf deploy, the same deploy would wipe every one of them. This blocks our migration.

Ask

A keepVars option on the worker config (or a --keep-vars deploy flag), matching Wrangler's keep_vars: true. Mapping keep_vars in cf migrate would follow from it.

Lenguaje dominante
TypeScript
Estrellas
960
Forks
62
Merge medio
19 h 7 min
PR fusionados (30 d)
193

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de cloudflare/cf

Todos los issues de cloudflare/cf

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.