defaults.go 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. package defaults
  2. // default config json structs
  3. // these get written to disk in absence of version server
  4. import (
  5. "goseg/structs"
  6. "path/filepath"
  7. )
  8. var (
  9. NetdataConfig = structs.NetdataConfig{
  10. NetdataName: "netdata",
  11. Repo: "registry.hub.docker.com/netdata/netdata",
  12. NetdataVersion: "latest",
  13. Amd64Sha256: "95e74c36f15091bcd7983ee162248f1f91c21207c235fce6b0d6f8ed9a11732a",
  14. Arm64Sha256: "cd3dc9d182a4561b162f03c6986f4647bbb704f8e7e4872ee0611b1b9e86e1b0",
  15. CapAdd: []string{"SYS_PTRACE"},
  16. Port: 19999,
  17. Restart: "unless-stopped",
  18. SecurityOpt: "apparmor=unconfined",
  19. Volumes: []string{
  20. "netdataconfig:/etc/netdata",
  21. "netdatalib:/var/lib/netdata",
  22. "netdatacache:/var/cache/netdata",
  23. "/etc/passwd:/host/etc/passwd:ro",
  24. "/etc/group:/host/etc/group:ro",
  25. "/proc:/host/proc:ro",
  26. "/sys:/host/sys:ro",
  27. "/etc/os-release:/host/etc/os-release:ro",
  28. },
  29. }
  30. McConfig = structs.McConfig{
  31. McName: "minio_client",
  32. McVersion: "latest",
  33. Repo: "registry.hub.docker.com/minio/mc",
  34. Amd64Sha256: "6ffd76764e8ca484de12c6ecaa352db3d8efd5c9d44f393718b29b6600e0a559",
  35. Arm64Sha256: "6825aecd2f123c9d4408e660aba8a72f9e547a3774350b8f4d2d9b674e99e424",
  36. }
  37. WgConfig = structs.WgConfig{
  38. WireguardName: "wireguard",
  39. WireguardVersion: "latest",
  40. Repo: "registry.hub.docker.com/linuxserver/wireguard",
  41. Amd64Sha256: "ae6f8e8cc1303bc9c0b5fa1b1ef4176c25a2c082e29bf8b554ce1196731e7db2",
  42. Arm64Sha256: "403d741b1b5bcf5df1e48eab0af8038355fae3e29419ad5980428f9aebd1576c",
  43. CapAdd: []string{"NET_ADMIN", "SYS_MODULE"},
  44. Volumes: []string{"/lib/modules:/lib/modules"},
  45. Sysctls: struct {
  46. NetIpv4ConfAllSrcValidMark int `json:"net.ipv4.conf.all.src_valid_mark"`
  47. }{
  48. NetIpv4ConfAllSrcValidMark: 1,
  49. },
  50. }
  51. )
  52. // this one needs params from config so we use a func
  53. func SysConfig(basePath string) structs.SysConfig {
  54. sysConfig := structs.SysConfig{
  55. Setup: "start",
  56. EndpointUrl: "api.startram.io",
  57. ApiVersion: "v1",
  58. Piers: []string{},
  59. NetCheck: "1.1.1.1:53",
  60. UpdateMode: "auto",
  61. UpdateUrl: "https://version.groundseg.app",
  62. UpdateBranch: "latest",
  63. SwapVal: 16,
  64. SwapFile: filepath.Join(basePath, "settings", "swapfile"),
  65. KeyFile: filepath.Join(basePath, "settings", "session.key"),
  66. Sessions: struct {
  67. Authorized map[string]structs.SessionInfo `json:"authorized"`
  68. Unauthorized map[string]structs.SessionInfo `json:"unauthorized"`
  69. }{
  70. Authorized: make(map[string]structs.SessionInfo),
  71. Unauthorized: make(map[string]structs.SessionInfo),
  72. },
  73. LinuxUpdates: struct {
  74. Value int `json:"value"`
  75. Interval string `json:"interval"`
  76. Previous bool `json:"previous"`
  77. }{
  78. Value: 1,
  79. Interval: "week",
  80. Previous: false,
  81. },
  82. DockerData: "/var/lib/docker",
  83. WgOn: false,
  84. WgRegistered: false,
  85. PwHash: "",
  86. C2cInterval: 0,
  87. FirstBoot: true,
  88. GsVersion: "v2.0.0",
  89. CfgDir: basePath,
  90. UpdateInterval: 0,
  91. BinHash: "",
  92. Pubkey: "",
  93. Privkey: "",
  94. Salt: "",
  95. }
  96. return sysConfig
  97. }