简体   繁体   English

如何在 Ubuntu 中创建 .env 文件?

[英]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.

相关问题 如何在 Linux Ubuntu 16.04 上保存 ENV VAR? - How can I save an ENV VAR on Linux Ubuntu 16.04? 如何在Linux Ubuntu 13中创建CSR(证书签名请求)文件? - How can i create a CSR (Certificate signing Request ) file in a Linux Ubuntu 13? 我无法更改我的 linux 权限。 我想创建一个 .env 文件 - I can't change my linux permissions. I want to create an .env file 如何设置我创建的任何Vim文件并附加#! 默认情况下/ usr / bin / env python - How to set any Vim file which i create to have appended with #! /usr/bin/env python by default 我如何将crontab保留在ubuntu docker中的文件中 - How can i keep crontab in file in ubuntu docker NodeJS是如何从ubuntu运行两个服务器文件? - NodeJS is how can I run two server file from ubuntu? 如何使用该Ubuntu服务器自动/定期将文件从FTP服务器复制到其他Ubuntu服务器? - How can I automatically/periodically copy a file from an FTP server to a different Ubuntu server, using that Ubuntu server? 如何在Ubuntu终端中创建文件,指定内容? - How to create file in Ubuntu terminal, specifying the content? 我在哪里可以找到UBUNTU上的.curlrc文件? - Where can I find .curlrc file on UBUNTU? 如何在每个文件夹中创建一个文件? - How can I create a file in each folder?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM