payment gateway for rpn cn
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

45 lignes
815B

  1. package main
  2. import (
  3. "encoding/json"
  4. "fmt"
  5. "io/ioutil"
  6. "log"
  7. )
  8. type AppConfig struct {
  9. Rpn struct {
  10. Url string `json:Url`
  11. UrlTest string `json:UrlTest`
  12. MD5P2P string `json:MD5P2P`
  13. MD5FAT string `json:MD5FAT`
  14. } `json:Rpn`
  15. LeanWork struct {
  16. MD5Key string `json:MD5Key`
  17. } `json:LeanWork`
  18. }
  19. var Config AppConfig
  20. func readConfig() error {
  21. log.Printf("Read configration from config.json")
  22. body, err := ioutil.ReadFile("config.json")
  23. if err != nil {
  24. log.Fatal("Fatal error Cannot read config ..")
  25. return err
  26. }
  27. err = json.Unmarshal(body, &Config)
  28. if err != nil {
  29. log.Fatal("cannot read config into json")
  30. return err
  31. }
  32. j, err := json.MarshalIndent(Config, "", "\t")
  33. if err != nil {
  34. log.Fatal("cannot print back to json")
  35. return err
  36. }
  37. fmt.Println(string(j))
  38. return err
  39. }