Skip to content

Commit 7cbc89a

Browse files
committed
Minor refactor
1 parent 0944aa3 commit 7cbc89a

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

cmd/miniflux-discord/main.go

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,21 @@ var (
1616
)
1717

1818
func parseEnv() error {
19-
envPort := os.Getenv("LISTEN_PORT")
20-
if envPort == "" {
21-
LISTEN_PORT = 8080
22-
} else {
19+
if envPort := os.Getenv("LISTEN_PORT"); envPort != "" {
2320
var err error
2421
LISTEN_PORT, err = strconv.Atoi(envPort)
2522
if err != nil {
2623
return err
2724
}
25+
} else {
26+
LISTEN_PORT = 8080
2827
}
2928

30-
envAddr := os.Getenv("LISTEN_ADDR")
31-
if envAddr == "" {
32-
LISTEN_ADDR = "0.0.0.0"
33-
} else {
29+
if envAddr := os.Getenv("LISTEN_ADDR"); envAddr != "" {
3430
// TODO: validate
3531
LISTEN_ADDR = envAddr
32+
} else {
33+
LISTEN_ADDR = "0.0.0.0"
3634
}
3735

3836
if discordFile := os.Getenv("DISCORD_WEBHOOK_URL_FILE"); discordFile != "" {

0 commit comments

Comments
 (0)