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

Introducing a new package? #159

Open
suntong opened this issue Nov 9, 2023 · 2 comments
Open

Introducing a new package? #159

suntong opened this issue Nov 9, 2023 · 2 comments

Comments

@suntong
Copy link

suntong commented Nov 9, 2023

I want to add a new method to replace the following series of fmt.Scanf with reading from .env instead:

orangeforum/management.go

Lines 208 to 226 in 5cf2e18

var smtpHost string
fmt.Printf("SMTP Host: ")
fmt.Scanf("%s\n", &smtpHost)
var smtpPort int
fmt.Printf("SMTP Port: ")
fmt.Scanf("%d\n", &smtpPort)
var smtpUser string
fmt.Printf("SMTP User: ")
fmt.Scanf("%s\n", &smtpUser)
var smtpPass string
fmt.Printf("SMTP Password: ")
fmt.Scanf("%s\n", &smtpPass)
var defaultFromEmail string
fmt.Printf("Default from email: ")
fmt.Scanf("%s\n", &defaultFromEmail)

OK?

The auto-reading from .env would be provided by github.com/joho/godotenv/autoload, to load .env file automatically.

@s-gv
Copy link
Owner

s-gv commented Nov 10, 2023 via email

@suntong
Copy link
Author

suntong commented Nov 10, 2023

That’s for the command line setup of the admin user. So, it reading from environment variables isn’t a great fit?

Hmm... I'm not replacing the current approach, but to add an option so that people can choose.

I've pushed my change so that you can take a peek --

https://github.com/suntong/orangeforum/compare/dev/newfeatures...suntong:orangeforum:dev/email?expand=1#diff-088d9f35d23a4347d221d71dd49b02b95001dff4abe637a40fe0bc04d502049c

It's fine we don't introduce a new package, I'll just define everything as environment variables for myself. Just we'll loose self-documented one-stop location for my next PR:

image

image

And the .env file will be convenient for configuring & launching the server too, as shown in the top # Runtime settings: section. Anyway, you decide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants