[英]How can I create a .env file in Ubuntu?
I have an app deployed on an AWS EC2 Ubuntu instance.我在 AWS EC2 Ubuntu 实例上部署了一个应用程序。 I use dotenv for development, but manually input my environment variables in production to avoid exposing them on GitHub.我使用 dotenv 进行开发,但在生产中手动输入我的环境变量以避免在 GitHub 上暴露它们。
My goal is to create a.env file outside my app directory so that I don't have to manually input my environment variables each time I deploy new code.我的目标是在我的 app 目录之外创建一个 .env 文件,这样我就不必在每次部署新代码时手动输入我的环境变量。
I've configured dotenv as follows:我已将 dotenv 配置如下:
require("dotenv").config({ path: "../../environment-variables/Ticketing-App/.env" });
Running "sudo touch.env" inside the Ticketing-App directory neither creates the file nor generates an error.在 Ticketing-App 目录中运行“sudo touch.env”既不会创建文件也不会产生错误。
Is it possible to create a.env file on Ubuntu?是否可以在 Ubuntu 上创建 a.env 文件? If so, how?如果是这样,怎么做?
Touch creates the file.触摸创建文件。 You created a hidden file by adding the period in front of the file name.您通过在文件名前添加句点创建了一个隐藏文件。 If you do cat.env
you should get a print in the terminal.如果你做cat.env
你应该在终端打印。 Doing nano.env
will allow you to edit the file.执行nano.env
将允许您编辑文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.