SvelteKit环境变量特殊字符($)问题

huangapple go评论57阅读模式
英文:

SvelteKit environment variables special character ($) issue

问题

无需翻译的部分:

Any ideas of a workaround without removing $?

Environment Variable: DB_PASS

.env file
DB_PASS = *^$php&!Bz

from '$env/static/private'
DB_PASS = *^&!Bz

Seemingly culprit character
$

env file

SvelteKit环境变量特殊字符($)问题

env console log

SvelteKit环境变量特殊字符($)问题

英文:

Any ideas of a workaround without removing $?

Environment Variable: DB_PASS

.env file
DB_PASS = *^$php&!Bz

from '$env/static/private'
DB_PASS = *^&!Bz

Seemingly culprit character
$

env file

SvelteKit环境变量特殊字符($)问题

env console log

SvelteKit环境变量特殊字符($)问题

答案1

得分: 1

明白了,感谢GitHub社区的支持。

Vite使用dotenv-expand默认扩展变量。

请注意,如果您想在环境值中使用$,您必须使用\进行转义。

链接地址:https://vitejs.dev/guide/env-and-mode.html#env-files

英文:

Got it, thanks to the GitHub community.

> Vite uses dotenv-expand to expand variables out of the box.
>
> Note that if you want to use $ inside your environment value, you have to escape it with \.

https://vitejs.dev/guide/env-and-mode.html#env-files

huangapple
  • 本文由 发表于 2023年2月18日 00:43:52
  • 转载请务必保留本文链接:https://go.coder-hub.com/75487032.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定