File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
deploy/early-access/reference Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,30 @@ Access environment variables using the `Deno.env.get` API:
95
95
const myEnvVar = Deno .env .get (" MY_ENV_VAR" );
96
96
```
97
97
98
+ ## Exposing an environment variable as a file
99
+
100
+ Environment variables can be exposed as a file instead of a regular environment
101
+ variable by toggling the "Expose as file" option.
102
+
103
+ When this option is enabled, the environment variable's value is stored in a
104
+ temporary file in the application's file system. The environment variable then
105
+ contains the file path to this temporary file instead of the value itself.
106
+
107
+ To read the value, you can use the ` Deno.readTextFile ` API in combination with
108
+ ` Deno.env.get ` :
109
+
110
+ ``` ts
111
+ // Assuming MY_ENV_VAR is set to expose as a file
112
+ const value = await Deno .readTextFile (Deno .env .get (" MY_ENV_VAR" ));
113
+ ```
114
+
115
+ This is useful for values that are too large for environment variables or when
116
+ you want to avoid exposing sensitive data in the environment variable list.
117
+
118
+ Additionally it is useful for preexisting applications that expect certain
119
+ environment variables to point to files, such as ` PGSSLROOTCERT ` for Postgres CA
120
+ certificates.
121
+
98
122
## Predefined environment variables
99
123
100
124
Deno Deploy<sup >EA</sup > provides these predefined environment variables in all
You can’t perform that action at this time.
0 commit comments