[GH-ISSUE #14] .env #6

Closed
opened 2026-02-26 18:32:55 +03:00 by kerem · 4 comments
Owner

Originally created by @ryanburnette on GitHub (Mar 11, 2021).
Original GitHub issue: https://github.com/decke/smtprelay/issues/14

Would you consider using .env for configuration so the binary could be portable? I can PR if you're open to the idea.

Originally created by @ryanburnette on GitHub (Mar 11, 2021). Original GitHub issue: https://github.com/decke/smtprelay/issues/14 Would you consider using .env for configuration so the binary could be portable? I can PR if you're open to the idea.
kerem closed this issue 2026-02-26 18:32:55 +03:00
Author
Owner

@decke commented on GitHub (Mar 12, 2021):

I am not fully sure about your proposal but I think you meant it would be good to have environment variables for all the config parameters that are currently in smtprelay.ini ? I assume you want to run this in a docker environment where this is quite common.

The research that I did so far did lead me to https://github.com/peterbourgon/ff which would be almost compatible from a code point of view to vharitonsky/iniflags which we are currently using. The main difference is a different config file format so we would need a slightly modified parser which seems to be simple when looking at the plaintext parser https://github.com/peterbourgon/ff/blob/master/parse.go#L236

<!-- gh-comment-id:797376989 --> @decke commented on GitHub (Mar 12, 2021): I am not fully sure about your proposal but I think you meant it would be good to have environment variables for all the config parameters that are currently in smtprelay.ini ? I assume you want to run this in a docker environment where this is quite common. The research that I did so far did lead me to https://github.com/peterbourgon/ff which would be almost compatible from a code point of view to vharitonsky/iniflags which we are currently using. The main difference is a different config file format so we would need a slightly modified parser which seems to be simple when looking at the plaintext parser https://github.com/peterbourgon/ff/blob/master/parse.go#L236
Author
Owner

@decke commented on GitHub (Mar 14, 2021):

To correct myself, .env file seems to be a docker feature which contains environment variables and their values (format VAR=VAL) which are parsed and passed to the environment of the container. So for smtprelay it should be enough to support environment variables for all config values. In addition to that there is a pull request https://github.com/peterbourgon/ff/pull/66 which adds a parser for .env files so it could be used instead of the ini file as well. We probably won't need it though.

<!-- gh-comment-id:798976480 --> @decke commented on GitHub (Mar 14, 2021): To correct myself, .env file seems to be a docker feature which contains environment variables and their values (format VAR=VAL) which are parsed and passed to the environment of the container. So for smtprelay it should be enough to support environment variables for all config values. In addition to that there is a pull request https://github.com/peterbourgon/ff/pull/66 which adds a parser for .env files so it could be used instead of the ini file as well. We probably won't need it though.
Author
Owner

@ryanburnette commented on GitHub (Jun 30, 2021):

I'm just used to .env as the normal approach, and it's been a while since I opened this issue, but I must not have noticed smtprelay.ini or understood that it was the configuration method. I editing source, recompiled, and had a configured binary, which I found to be a less flexible approach.

Closing.

<!-- gh-comment-id:871307054 --> @ryanburnette commented on GitHub (Jun 30, 2021): I'm just used to .env as the normal approach, and it's been a while since I opened this issue, but I must not have noticed smtprelay.ini or understood that it was the configuration method. I editing source, recompiled, and had a configured binary, which I found to be a less flexible approach. Closing.
Author
Owner

@decke commented on GitHub (Aug 15, 2022):

Quite recently smtprelay switched to using a different config file parser which also supports .env files.

https://github.com/peterbourgon/ff/pull/89

<!-- gh-comment-id:1214979348 --> @decke commented on GitHub (Aug 15, 2022): Quite recently smtprelay switched to using a different config file parser which also supports .env files. https://github.com/peterbourgon/ff/pull/89
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#6
No description provided.