summaryrefslogtreecommitdiff
path: root/internal/discovery/discovery_embed.go
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2023-02-27 15:46:56 +0100
committerjwijenbergh <jeroenwijenbergh@protonmail.com>2023-02-27 15:46:56 +0100
commit6f8e016fcff9c1c47474b6c0b6c3c09d37d64e1a (patch)
treeaa2e0a80af8b151737a3375943a4858ad66ea383 /internal/discovery/discovery_embed.go
parent92e437148078466cd949df7043330b78ae0ff65f (diff)
Discovery: Conditionally embed latest discovery files for local cache
Conditionally embedding based on https://github.com/golang/go/issues/44484#issuecomment-948137497 To use it, wget the discovery files into the internal/discovery folder (same JSON name) after verifying the signature. Then build with -tags=release
Diffstat (limited to 'internal/discovery/discovery_embed.go')
-rw-r--r--internal/discovery/discovery_embed.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/internal/discovery/discovery_embed.go b/internal/discovery/discovery_embed.go
new file mode 100644
index 0000000..efd85dd
--- /dev/null
+++ b/internal/discovery/discovery_embed.go
@@ -0,0 +1,20 @@
+//go:build release
+// +build release
+
+package discovery
+
+import _ "embed"
+
+// eServers are the embedded server list
+//
+//go:embed server_list.json
+var eServers []byte
+
+// eOrganizations are the embedded organizations
+//
+//go:embed organization_list.json
+var eOrganizations []byte
+
+func init() {
+ HasCache = true
+}