[PR #72] [MERGED] Support environment variables for config #101

Closed
opened 2026-02-26 18:33:21 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/decke/smtprelay/pull/72
Author: @decke
Created: 5/23/2022
Status: Merged
Merged: 5/25/2022
Merged by: @decke

Base: masterHead: ff-config


📝 Commits (7)

  • 2647717 Replace iniflags config file parser with peterbourgon/ff/v3
  • 8cc31a9 Properly handle config parsing errors because logging is not setup yet
  • 7e3dbd5 Add config parameter for ini file
  • e9a2b9a Fix IniParser() to support various common formats
  • f69d1f0 Improve examples in ini file to not quote strings at all
  • c83544b Add note how to use environment variables for configuration
  • 1bf205e Compress if statement

📊 Changes

5 files changed (+96 additions, -31 deletions)

View changed files

📝 README.md (+1 -0)
📝 config.go (+81 -24)
📝 go.mod (+1 -1)
📝 go.sum (+5 -2)
📝 smtprelay.ini (+8 -4)

📄 Description

As requested in #14 and discussed a few times it makes sense in container environments to support environment variables for configuration.

This PR switches github.com/vharitonsky/iniflags to github.com/peterbourgon/ff/v3 which is very similar and supports environment variables. IniParser was created based on his PlainParser example (Apache 2.0 license). Small tweaks were necessary like providing a separate flagset for the options.


🔄 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/decke/smtprelay/pull/72 **Author:** [@decke](https://github.com/decke) **Created:** 5/23/2022 **Status:** ✅ Merged **Merged:** 5/25/2022 **Merged by:** [@decke](https://github.com/decke) **Base:** `master` ← **Head:** `ff-config` --- ### 📝 Commits (7) - [`2647717`](https://github.com/decke/smtprelay/commit/26477177fef1a6b09c8604eec59eb52b02cbc30c) Replace iniflags config file parser with peterbourgon/ff/v3 - [`8cc31a9`](https://github.com/decke/smtprelay/commit/8cc31a918b508fe38aa0c8cd9ac78041b3e3219f) Properly handle config parsing errors because logging is not setup yet - [`7e3dbd5`](https://github.com/decke/smtprelay/commit/7e3dbd515d9a52c978b6139f5e0980fd80207978) Add config parameter for ini file - [`e9a2b9a`](https://github.com/decke/smtprelay/commit/e9a2b9ad5a308fb4b39058a81c72b1b3eb0b5f68) Fix IniParser() to support various common formats - [`f69d1f0`](https://github.com/decke/smtprelay/commit/f69d1f0114145c9135d4064da6823d35e1288ad5) Improve examples in ini file to not quote strings at all - [`c83544b`](https://github.com/decke/smtprelay/commit/c83544bd903ec76380e68e3fca129915eaef39e7) Add note how to use environment variables for configuration - [`1bf205e`](https://github.com/decke/smtprelay/commit/1bf205e7d82bd3c2f70194f1d75d0b6eaa0add81) Compress if statement ### 📊 Changes **5 files changed** (+96 additions, -31 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+1 -0) 📝 `config.go` (+81 -24) 📝 `go.mod` (+1 -1) 📝 `go.sum` (+5 -2) 📝 `smtprelay.ini` (+8 -4) </details> ### 📄 Description As requested in #14 and discussed a few times it makes sense in container environments to support environment variables for configuration. This PR switches [github.com/vharitonsky/iniflags](https://github.com/vharitonsky/iniflags) to [github.com/peterbourgon/ff/v3](https://github.com/peterbourgon/ff/v3) which is very similar and supports environment variables. IniParser was created based on his PlainParser example (Apache 2.0 license). Small tweaks were necessary like providing a separate flagset for the options. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-26 18:33:21 +03:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/smtprelay#101
No description provided.