Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PM-17353] feat: allow configuring GlobalSettings via KeyPerFile configuration provider #5303

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mu88
Copy link

@mu88 mu88 commented Jan 20, 2025

With this change, one can make use of Docker Compose Secrets.

🎟️ Tracking

https://community.bitwarden.com/t/add-support-for-docker-secrets-to-self-host-project/69705/3

📔 Objective

Since there was/is no vital conversion in the corresponding Discourse thread, I thought I give it a shot and propose my desired change as a PR. Please bear with me if this violates one of your processes - I'm happy to learn and adapt 🙂

As written in the corresponding thread, it would be great if one could make use of Docker Compose Secrets, especially for passing installation ID and key. Of course, following the common _FILE suffix convention would be the very best solution. But as a first step in this direction, I decided to add the Key-per-file configuration provider so that one can start a Docker stack like this:

services:
  bitwarden:
    image: bitwarden/self-host:beta
    volumes:
      - ./data:/etc/bitwarden
    ports:
      - "8080:8080"
    environment:
      - BW_ENABLE_SSL=false
      - BW_DB_PROVIDER=sqlite
      - BW_DOMAIN=my.app.domain
      - GlobalSettings__Installation__FileConfigDirectory=/run/secrets/
    secrets:
      - GlobalSettings__Installation__Id
      - GlobalSettings__Installation__Key
secrets:
  GlobalSettings__Installation__Id:
    file: ./installation_id.txt
  GlobalSettings__Installation__Key:
    file: ./installation_key.txt

This way, .NET will automatically pick up all files within the config directory /run/secrets (which is the default of Docker Compose, see here) and map them convention-based to the corresponding config object.

📸 Screenshots

Not applicable since there is no UI change.

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team

🦮 Reviewer guidelines

  • 👍 (:+1:) or similar for great changes
  • 📝 (:memo:) or ℹ️ (:information_source:) for notes or general info
  • ❓ (:question:) for questions
  • 🤔 (:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion
  • 🎨 (:art:) for suggestions / improvements
  • ❌ (:x:) or ⚠️ (:warning:) for more significant problems or concerns needing attention
  • 🌱 (:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt
  • ⛏ (:pick:) for minor or nitpick changes

@CLAassistant
Copy link

CLAassistant commented Jan 20, 2025

CLA assistant check
All committers have signed the CLA.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@bitwarden-bot
Copy link

Thank you for your contribution! We've added this to our internal Community PR board for review.
ID: PM-17353
Link: https://bitwarden.atlassian.net/browse/PM-17353

Details on our contribution process can be found here: https://contributing.bitwarden.com/contributing/pull-requests/community-pr-process.

@bitwarden-bot bitwarden-bot changed the title feat: allow configuring GlobalSettings via KeyPerFile configuration provider [PM-17353] feat: allow configuring GlobalSettings via KeyPerFile configuration provider Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants