9e38b000ec
1. Move all pre-defined messages to constants in a separate file 2. Remove pkg/errors dependency
21 lines
392 B
Go
21 lines
392 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/kelseyhightower/envconfig"
|
|
)
|
|
|
|
func parseEnv() (*config, error) {
|
|
c := new(config)
|
|
if err := envconfig.Process(appID, c); err != nil {
|
|
return nil, fmt.Errorf("failed to parse env: %w", err)
|
|
}
|
|
return c, nil
|
|
}
|
|
|
|
type config struct {
|
|
TelegramBotToken string `envconfig:"telegram_bot_token"`
|
|
OwnerChatID int `envconfig:"owner_chat_id"`
|
|
}
|