Create savepoint

This commit is contained in:
Victor Truong 2020-06-30 02:23:49 -07:00
commit 8b6f5d360c
7 changed files with 159 additions and 0 deletions

26
pkg/jia/config.go Normal file
View file

@ -0,0 +1,26 @@
package jia
import (
"os"
)
type Config struct {
BotToken string
ChannelId string
}
func NewConfig() *Config {
return &Config{
BotToken: getEnv("SLACK_CLIENT_BOT_TOKEN", ""),
ChannelId: getEnv("SLACK_CHANNEL_ID", ""),
}
}
func getEnv(key string, defaultValue string) string {
value, exists := os.LookupEnv(key)
if exists {
return value
}
return defaultValue
}