英文:
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

env console log

英文:
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

env console log

答案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 \.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论