mirror of
https://github.com/cjdenio/jia.git
synced 2025-05-14 17:33:05 +00:00
Create savepoint
This commit is contained in:
commit
8b6f5d360c
7 changed files with 159 additions and 0 deletions
26
pkg/jia/config.go
Normal file
26
pkg/jia/config.go
Normal 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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue