goNmapTelegramBot/readConfig.go
readConfig.goRaw
1package main
2
3import (
4 "encoding/json"
5 "fmt"
6 "io/ioutil"
7)
8
9//Config stores the data from json twitterConfig.json file
10type Config struct {
11 TelegramBotToken string `json:"telegramBotToken"`
12}
13
14var config Config
15
16func readConfig() {
17 file, e := ioutil.ReadFile("config.json")
18 if e != nil {
19 fmt.Println("error:", e)
20 }
21 content := string(file)
22 json.Unmarshal([]byte(content), &config)
23 fmt.Println("config.json read comlete, Telegram bot ready")
24
25}