You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

39 lines
656 B

package main
import (
"encoding/json"
"fmt"
"io/ioutil"
)
type Config struct {
Url string `json:"url"`
}
var config Config
type User struct {
Username string `json:"username"`
Password string `json:"password"`
Email string `json:"email"`
Token string `json:"token"`
}
var users []User
func readUsers() {
file, e := ioutil.ReadFile("users.json")
if e != nil {
fmt.Println("error:", e)
}
content := string(file)
json.Unmarshal([]byte(content), &users)
}
func readConfig() {
file, e := ioutil.ReadFile("config.json")
if e != nil {
fmt.Println("error:", e)
}
content := string(file)
json.Unmarshal([]byte(content), &config)
}