[PR #2315] [MERGED] Add support for custom .env file path #3273

Open
opened 2025-10-09 18:20:17 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/dani-garcia/vaultwarden/pull/2315
Author: @TinfoilSubmarine
Created: 2/16/2022
Status: Merged
Merged: 2/28/2022
Merged by: @dani-garcia

Base: mainHead: custom-env-path


📝 Commits (2)

  • 8295688 Add support for custom .env file path
  • c59a7f4 document ENV_FILE variable usage

📊 Changes

2 files changed (+6 additions, -1 deletions)

View changed files

📝 .env.template (+5 -0)
📝 src/config.rs (+1 -1)

📄 Description

Hi! I'm working on packaging this for Void, and in writing the runit service, I came across an annoyance: since the .env file can't be in the current working directory, it won't find it and thus has to read from the environment variables directly. This can be done with something like:

#!/bin/sh
exec chpst -u _vaultwarden:_vaultwarden \
        env $(grep -v '^#' ${ENV_FILE:-/etc/vaultwarden.env} | xargs -d '\n') vaultwarden

But that is less than ideal IMO. This patch is a simple way to pass a single custom location where the env/config can be found.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/dani-garcia/vaultwarden/pull/2315 **Author:** [@TinfoilSubmarine](https://github.com/TinfoilSubmarine) **Created:** 2/16/2022 **Status:** ✅ Merged **Merged:** 2/28/2022 **Merged by:** [@dani-garcia](https://github.com/dani-garcia) **Base:** `main` ← **Head:** `custom-env-path` --- ### 📝 Commits (2) - [`8295688`](https://github.com/dani-garcia/vaultwarden/commit/8295688bed720c8f0b5a7bfb9b0e0586463a1004) Add support for custom .env file path - [`c59a7f4`](https://github.com/dani-garcia/vaultwarden/commit/c59a7f4a8cb5d2c2cd03e82ca909eb753303fb0b) document ENV_FILE variable usage ### 📊 Changes **2 files changed** (+6 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `.env.template` (+5 -0) 📝 `src/config.rs` (+1 -1) </details> ### 📄 Description Hi! I'm working on packaging this for Void, and in writing the runit service, I came across an annoyance: since the `.env` file can't be in the current working directory, it won't find it and thus has to read from the environment variables directly. This *can* be done with something like: ``` #!/bin/sh exec chpst -u _vaultwarden:_vaultwarden \ env $(grep -v '^#' ${ENV_FILE:-/etc/vaultwarden.env} | xargs -d '\n') vaultwarden ``` But that is less than ideal IMO. This patch is a simple way to pass a single custom location where the env/config can be found. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
OVERLORD added the pull-request label 2025-10-09 18:20:18 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/vaultwarden#3273