You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Private tokens, like a Prismic repository's access token or Custom Types API token, should generally not be committed to a Git repository. Using .env files is a common practice to exclude private data from committed code.
Currently, prismic-ts-codegen requires an access token and/or Custom Types API token for certain configurations, but does not provide a straightforward way to do so securely.
Describe the solution you'd like
prismic-ts-codegen could automatically load .env files from the working directory. Loading a .env file populates the global process.env object with arbitrary data, which could be used to load private tokens.
The dotenv package is the most commonly used package to load .env files. While that exact package does not need to be used, its .env loading practices are industry-standard.
Something to consider: some frameworks have .env naming conventions. For example, .env.local (as seen in Next.js) and .env.development are common conventions. Which .env file is loaded can be a prismic-ts-codegen configuration property, but good defaults results in a smoother experience.
Describe alternatives you've considered
Because prismic-ts-codegen's config is written in a TypeScript or JavaScript file (prismicCodegen.config.{ts|js}), the dotenv package could be used manually. It is easy to set up, but ultimately is more friction than having that functionality built in to the tool.
Additional context
Thanks to @a-trost for prompting this feature request. 🐴
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
Private tokens, like a Prismic repository's access token or Custom Types API token, should generally not be committed to a Git repository. Using
.env
files is a common practice to exclude private data from committed code.Currently,
prismic-ts-codegen
requires an access token and/or Custom Types API token for certain configurations, but does not provide a straightforward way to do so securely.Describe the solution you'd like
prismic-ts-codegen
could automatically load.env
files from the working directory. Loading a.env
file populates the globalprocess.env
object with arbitrary data, which could be used to load private tokens.The
dotenv
package is the most commonly used package to load.env
files. While that exact package does not need to be used, its.env
loading practices are industry-standard.Something to consider: some frameworks have
.env
naming conventions. For example,.env.local
(as seen in Next.js) and.env.development
are common conventions. Which.env
file is loaded can be aprismic-ts-codegen
configuration property, but good defaults results in a smoother experience.Describe alternatives you've considered
Because
prismic-ts-codegen
's config is written in a TypeScript or JavaScript file (prismicCodegen.config.{ts|js}
), thedotenv
package could be used manually. It is easy to set up, but ultimately is more friction than having that functionality built in to the tool.Additional context
Thanks to @a-trost for prompting this feature request. 🐴
The text was updated successfully, but these errors were encountered: