Phase 13, part 6: each team's Core

On the server and multi-tenant editions a team's admin enters its Core's
domain and account under Settings → Core & Hermes, instead of core.conf;
Hermes connects from the team's side with an agent's key.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-25 12:29:44 -07:00
co-authored by Claude Opus 5.5
parent af6598271c
commit 1865140507
13 changed files with 166 additions and 34 deletions
+13 -1
View File
@@ -55,7 +55,7 @@ tools over MCP, approvals, limits and visibility, and the JSON API. Schema
39. 39.
**Phase 13 (multi-tenant) is under way** on branch `phase13`, with a **Phase 13 (multi-tenant) is under way** on branch `phase13`, with a
Postgres schema per team (decided 2026-11-26); parts 1–5 are built. Postgres schema per team (decided 2026-11-26); parts 1–6 are built.
**Phase 12 (signing in with the Core, OIDC) is set aside for now** **Phase 12 (signing in with the Core, OIDC) is set aside for now**
(2026-11-26): before it starts, the user will share the Federated Core's (2026-11-26): before it starts, the user will share the Federated Core's
@@ -2883,6 +2883,18 @@ stand.
- Left for Phase 14, which sets them by plan: limits on outgoing fetches - Left for Phase 14, which sets them by plan: limits on outgoing fetches
and storage. and storage.
**Part 6 built 2026-11-26** on `phase13`.
- On the server and multi-tenant editions, each team's admin enters its
Core's domain, and the Core account Hermes works for, under Settings →
Core & Hermes (a team setting, `core:team`); the local edition still
reads CoreDesktop's `core.conf`. Everything that used the Core (EspoCRM,
Listmonk's and Plausible's addresses, the MCP hub, the checks) reads the
team's. Saving or clearing it is recorded as a connection.
- On those editions the page tells how Hermes connects: an agent with the
CRM scope (Settings → Agents), its key, and `https://…/mcp`; the socket
and the hand setup are the local edition's. The platform never holds a
Core's admin credentials.
1. **Teams everywhere.** 1. **Teams everywhere.**
- Every table that holds a company's data gets `team_id`, and its - Every table that holds a company's data gets `team_id`, and its
unique keys include it. The settings table's key becomes unique keys include it. The settings table's key becomes
+5 -5
View File
@@ -26,8 +26,8 @@ func (s *Server) giteaURL() string {
if _, err := s.DB.GetJSON(giteaURLKey, &u); err == nil && u != "" { if _, err := s.DB.GetJSON(giteaURLKey, &u); err == nil && u != "" {
return u return u
} }
if s.Core != nil && s.Core.Domain != "" { if s.core() != nil && s.core().Domain != "" {
return "https://gitea." + s.Core.Domain return "https://gitea." + s.core().Domain
} }
return "" return ""
} }
@@ -53,14 +53,14 @@ func (s *Server) applier(site seoSite) *seo.Applier {
// commitAuthor is who Supermarket's commits are by: the Core's user, via // commitAuthor is who Supermarket's commits are by: the Core's user, via
// Supermarket. // Supermarket.
func (s *Server) commitAuthor() string { func (s *Server) commitAuthor() string {
if s.Core != nil && s.Core.Email != "" { if s.core() != nil && s.core().Email != "" {
name := s.Core.Name name := s.core().Name
if name == "" { if name == "" {
name = "Supermarket" name = "Supermarket"
} else { } else {
name += " (via Supermarket)" name += " (via Supermarket)"
} }
return name + " <" + s.Core.Email + ">" return name + " <" + s.core().Email + ">"
} }
return "Supermarket <supermarket@localhost>" return "Supermarket <supermarket@localhost>"
} }
+4 -4
View File
@@ -248,12 +248,12 @@ func (s *Server) connectionsPage(w http.ResponseWriter, r *http.Request) {
} }
rows = append(rows, row) rows = append(rows, row)
} }
// The Core and Hermes, on the local edition. // The Core and Hermes.
var core []connRow var core []connRow
if !s.signsIn() { {
row := connRow{service: service{ID: "core", Name: "Federated Core", For: "The Core's services and the CRM, through Hermes", Link: "/settings/core"}, State: "missing"} row := connRow{service: service{ID: "core", Name: "Federated Core", For: "The Core's services and the CRM, through Hermes", Link: "/settings/core"}, State: "missing"}
if s.Core != nil { if s.core() != nil {
row.State, row.Detail = "connected", coreDomain(s.Core) row.State, row.Detail = "connected", coreDomain(s.core())
} }
core = append(core, row) core = append(core, row)
hermes := connRow{service: service{ID: "hermes", Name: "Hermes bridge", For: "The CRM, through the Core's MCP hub", Link: "/settings/core"}, State: "missing"} hermes := connRow{service: service{ID: "hermes", Name: "Hermes bridge", For: "The CRM, through the Core's MCP hub", Link: "/settings/core"}, State: "missing"}
+76
View File
@@ -0,0 +1,76 @@
package web
import (
"errors"
"net/http"
"regexp"
"strings"
"supermarket/internal/core"
"supermarket/internal/users"
)
// The Federated Core a team uses. The local edition reads CoreDesktop's
// core.conf; on the server and multi-tenant editions each team's admin
// enters its Core's domain under Settings → Core & Hermes. Hermes and the
// CRM bridge then connect from the team's side with an agent's key: the
// platform never holds a Core's admin credentials.
const coreKey = "core:team"
type coreSetting struct {
Domain string `json:"domain"`
Email string `json:"email"` // the Core account Hermes acts for (its MCP hub user)
}
// core is the team's Core, or nil.
func (s *Server) core() *core.Core {
if !s.signsIn() {
return s.Core
}
var c coreSetting
if ok, err := s.DB.GetJSON(coreKey, &c); err != nil || !ok || c.Domain == "" {
return nil
}
return &core.Core{Domain: c.Domain, Email: c.Email}
}
var hostRe = regexp.MustCompile(`^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$`)
// coreSave sets (or, empty, forgets) the team's Core.
func (s *Server) coreSave(w http.ResponseWriter, r *http.Request) {
if !s.signsIn() {
http.NotFound(w, r)
return
}
domain := strings.ToLower(strings.TrimSpace(r.PostFormValue("domain")))
domain = strings.TrimSuffix(strings.TrimPrefix(strings.TrimPrefix(domain, "https://"), "http://"), "/")
email := strings.TrimSpace(r.PostFormValue("email"))
if domain == "" {
if err := s.DB.PutJSON(coreKey, coreSetting{}); err != nil {
s.serverError(w, err)
return
}
s.recordConnection(r, "core", false)
redirect(w, r, "/settings/core", "saved")
return
}
var problem error
if !hostRe.MatchString(domain) {
problem = errors.New("give the Core's domain, such as example.com")
} else if email != "" {
if _, err := users.NormalEmail(email); err != nil {
problem = errors.New("the Core account isn't an email address")
}
}
if problem != nil {
s.renderCore(w, r, sentence(problem.Error())+".")
return
}
if err := s.DB.PutJSON(coreKey, coreSetting{Domain: domain, Email: email}); err != nil {
s.serverError(w, err)
return
}
s.recordConnection(r, "core", true)
redirect(w, r, "/settings/core", "saved")
}
+4 -4
View File
@@ -77,7 +77,7 @@ func (s *Server) renderCRM(w http.ResponseWriter, r *http.Request, errMsg string
"Job": hermesCRMJob, "Job": hermesCRMJob,
"JobID": s.crmJobID(), "JobID": s.crmJobID(),
"Waiting": counts[crm.StatusPending] + counts[crm.StatusClaimed], "Waiting": counts[crm.StatusPending] + counts[crm.StatusClaimed],
"Unreachable": s.Core != nil && unreachableError(actions) != "", "Unreachable": s.core() != nil && unreachableError(actions) != "",
}}) }})
} }
@@ -127,11 +127,11 @@ func (s *Server) crmReach(w http.ResponseWriter, r *http.Request) {
return return
} }
failure := unreachableError(actions) failure := unreachableError(actions)
if s.Core == nil || failure == "" { if s.core() == nil || failure == "" {
s.fragment(w, r, "crm", "reach", nil) s.fragment(w, r, "crm", "reach", nil)
return return
} }
check := probe(r.Context(), core.Service{Name: "EspoCRM", URL: espoCRMURL(s.Core)}) check := probe(r.Context(), core.Service{Name: "EspoCRM", URL: espoCRMURL(s.core())})
tried := "" tried := ""
for _, m := range connErr.FindAllStringSubmatch(failure, -1) { for _, m := range connErr.FindAllStringSubmatch(failure, -1) {
if m[2] != "" { if m[2] != "" {
@@ -143,7 +143,7 @@ func (s *Server) crmReach(w http.ResponseWriter, r *http.Request) {
"Check": check, "Check": check,
"Tried": tried, "Tried": tried,
"Error": failure, "Error": failure,
"HubHost": "mcphub." + s.Core.Domain, "HubHost": "mcphub." + s.core().Domain,
}) })
} }
+2 -2
View File
@@ -36,8 +36,8 @@ func (s *Server) renderForms(w http.ResponseWriter, r *http.Request, errMsg, fla
all, cur := s.currentSite(r) all, cur := s.currentSite(r)
data := map[string]any{"Sites": all, "Current": cur, "Gitea": s.gitea() != nil, "Payload": sites.LeadPayloadFields, data := map[string]any{"Sites": all, "Current": cur, "Gitea": s.gitea() != nil, "Payload": sites.LeadPayloadFields,
"Goal": tracking.LeadGoal, "Plausible": s.plausible() != nil} "Goal": tracking.LeadGoal, "Plausible": s.plausible() != nil}
if s.Core != nil && s.Core.Domain != "" { if s.core() != nil && s.core().Domain != "" {
data["CRM"] = "https://espocrm." + s.Core.Domain data["CRM"] = "https://espocrm." + s.core().Domain
} }
if cur != nil && cur.Repo != "" { if cur != nil && cur.Repo != "" {
var capture string var capture string
+2 -2
View File
@@ -36,8 +36,8 @@ var listmonkToken = secretField{"listmonk", secrets.ListmonkToken, "API token",
func (s *Server) listmonkConfig() listmonkSettings { func (s *Server) listmonkConfig() listmonkSettings {
var set listmonkSettings var set listmonkSettings
_, _ = s.DB.GetJSON(listmonkKey, &set) _, _ = s.DB.GetJSON(listmonkKey, &set)
if set.URL == "" && s.Core != nil { if set.URL == "" && s.core() != nil {
set.URL = "https://listmonk." + s.Core.Domain set.URL = "https://listmonk." + s.core().Domain
} }
return set return set
} }
+1 -1
View File
@@ -24,7 +24,7 @@ var mailPassword = secretField{"mail", secrets.MailPassword, "Password",
// outreachSettings are the saved email settings, or the defaults. // outreachSettings are the saved email settings, or the defaults.
func (s *Server) outreachSettings() (outreach.Settings, bool) { func (s *Server) outreachSettings() (outreach.Settings, bool) {
p, _ := profile.Load(s.DB) p, _ := profile.Load(s.DB)
set, ok, err := outreach.Load(s.DB, s.Core, p) set, ok, err := outreach.Load(s.DB, s.core(), p)
if err != nil { if err != nil {
s.Log.Error("loading the email settings", "err", err) s.Log.Error("loading the email settings", "err", err)
} }
+19 -9
View File
@@ -143,8 +143,8 @@ func (s *Server) dashboard(w http.ResponseWriter, r *http.Request) {
Detail: inventorySummary(counts)}, Detail: inventorySummary(counts)},
{Label: "Social accounts", Done: len(s.postingAccounts()) > 0, {Label: "Social accounts", Done: len(s.postingAccounts()) > 0,
Link: "/settings/accounts", Detail: s.connectionSummary(conns)}, Link: "/settings/accounts", Detail: s.connectionSummary(conns)},
{Label: "Federated Core", Done: s.Core != nil, Link: "/settings/core", {Label: "Federated Core", Done: s.core() != nil, Link: "/settings/core",
Detail: ifElse(s.Core != nil, coreDomain(s.Core), "No Core found; run `configure core` in CoreDesktop")}, Detail: ifElse(s.core() != nil, coreDomain(s.core()), "No Core found; run `configure core` in CoreDesktop")},
{Label: "Hermes bridge", Done: last != nil, Link: "/settings/core", {Label: "Hermes bridge", Done: last != nil, Link: "/settings/core",
Detail: ifElse(last != nil, "Last check-in "+ago(atOf(last)), "Hermes hasn't checked in yet")}, Detail: ifElse(last != nil, "Last check-in "+ago(atOf(last)), "Hermes hasn't checked in yet")},
} }
@@ -248,16 +248,22 @@ type coreData struct {
Prompt string Prompt string
HermesConfig string HermesConfig string
HermesEnv string HermesEnv string
Server bool // the server editions: the Core is entered here, Hermes uses an agent key
Problem string
} }
func (s *Server) corePage(w http.ResponseWriter, r *http.Request) { func (s *Server) corePage(w http.ResponseWriter, r *http.Request) {
s.renderCore(w, r, "")
}
func (s *Server) renderCore(w http.ResponseWriter, r *http.Request, problem string) {
last, err := bridge.Last(s.DB) last, err := bridge.Last(s.DB)
if err != nil { if err != nil {
s.serverError(w, err) s.serverError(w, err)
return return
} }
d := coreData{ d := coreData{
Core: s.Core, Core: s.core(),
MCPURL: "http://127.0.0.1:" + publicPort(s.PublicURL) + "/mcp", MCPURL: "http://127.0.0.1:" + publicPort(s.PublicURL) + "/mcp",
MCPToken: s.MCPToken, MCPToken: s.MCPToken,
MCPSocket: s.MCPSocket, MCPSocket: s.MCPSocket,
@@ -265,9 +271,9 @@ func (s *Server) corePage(w http.ResponseWriter, r *http.Request) {
Prompt: bridge.CheckinPrompt, Prompt: bridge.CheckinPrompt,
} }
hub := "https://mcphub.<your Core's domain>/sse?as_user=<your user name>" hub := "https://mcphub.<your Core's domain>/sse?as_user=<your user name>"
if s.Core != nil { if s.core() != nil {
d.User = s.Core.User() d.User = s.core().User()
hub = s.Core.MCPHubURL() hub = s.core().MCPHubURL()
} }
d.HubURL = hub d.HubURL = hub
d.HermesConfig = `mcp_servers: d.HermesConfig = `mcp_servers:
@@ -280,7 +286,11 @@ func (s *Server) corePage(w http.ResponseWriter, r *http.Request) {
command: socat command: socat
args: ["STDIO", "UNIX-CONNECT:` + d.MCPSocket + `"]` args: ["STDIO", "UNIX-CONNECT:` + d.MCPSocket + `"]`
d.HermesEnv = `MCPHUB_AUTH=<your own hub token from your Core: the part after "Basic ">` d.HermesEnv = `MCPHUB_AUTH=<your own hub token from your Core: the part after "Basic ">`
s.render(w, r, "core", page{Title: "Core & Hermes", Nav: "settings/core", Data: d}) d.Server, d.Problem = s.signsIn(), problem
if d.Server {
d.MCPURL = s.mcpURL()
}
s.render(w, r, "core", page{Title: "Core & Hermes", Nav: "settings/core", Error: problem, Data: d})
} }
func publicPort(u string) string { func publicPort(u string) string {
@@ -334,11 +344,11 @@ func probe(ctx context.Context, svc core.Service) serviceCheck {
// coreChecks asks each Core service whether it answers. It's an htmx // coreChecks asks each Core service whether it answers. It's an htmx
// fragment, loaded after the page so a slow service doesn't hold it up. // fragment, loaded after the page so a slow service doesn't hold it up.
func (s *Server) coreChecks(w http.ResponseWriter, r *http.Request) { func (s *Server) coreChecks(w http.ResponseWriter, r *http.Request) {
if s.Core == nil { if s.core() == nil {
s.fragment(w, r, "core", "checks", nil) s.fragment(w, r, "core", "checks", nil)
return return
} }
services := s.Core.Services() services := s.core().Services()
checks := make([]serviceCheck, len(services)) checks := make([]serviceCheck, len(services))
var wg sync.WaitGroup var wg sync.WaitGroup
for i, svc := range services { for i, svc := range services {
+1
View File
@@ -550,6 +550,7 @@ func (s *Server) Handler() (http.Handler, error) {
mux.HandleFunc("POST /settings/posting/{id}/remove", (*Server).postingRemove) mux.HandleFunc("POST /settings/posting/{id}/remove", (*Server).postingRemove)
mux.HandleFunc("POST /settings/account/posting/{id}/remove", (*Server).postingRemove) mux.HandleFunc("POST /settings/account/posting/{id}/remove", (*Server).postingRemove)
mux.HandleFunc("GET /settings/core", (*Server).corePage) mux.HandleFunc("GET /settings/core", (*Server).corePage)
mux.HandleFunc("POST /settings/core", (*Server).coreSave)
mux.HandleFunc("GET /settings/core/checks", (*Server).coreChecks) mux.HandleFunc("GET /settings/core/checks", (*Server).coreChecks)
// Where these pages used to be, for bookmarks. // Where these pages used to be, for bookmarks.
+22
View File
@@ -358,3 +358,25 @@ func TestJobsRunPerTeam(t *testing.T) {
t.Errorf("files %s", ts.Files.String()) t.Errorf("files %s", ts.Files.String())
} }
} }
func TestCorePerTeam(t *testing.T) {
s, h := newMultiEdition(t)
_, _, ac := newTeam(t, s, "Acme", "olu@acme.example")
_, _, bc := newTeam(t, s, "Bolt", "bea@bolt.example")
if rec := as(h, ac, http.MethodPost, "/settings/core", url.Values{"domain": {"not a domain"}}); !strings.Contains(rec.Body.String(), "the Core&#39;s domain") {
t.Errorf("bad domain: %s", rec.Body.String())
}
if rec := as(h, ac, http.MethodPost, "/settings/core", url.Values{"domain": {"https://core.acme.example/"}, "email": {"olu@core.acme.example"}}); rec.Code != http.StatusSeeOther {
t.Fatalf("save: %d", rec.Code)
}
body := as(h, ac, http.MethodGet, "/settings/core", nil).Body.String()
if !strings.Contains(body, `value="core.acme.example"`) || !strings.Contains(body, "Settings → Agents") || strings.Contains(body, "mcp.sock") {
t.Errorf("core page: %s", body)
}
if body := as(h, bc, http.MethodGet, "/settings/core", nil).Body.String(); strings.Contains(body, "acme") {
t.Error("another team's Core")
}
if body := as(h, ac, http.MethodGet, "/settings/connections", nil).Body.String(); !strings.Contains(body, "core.acme.example") {
t.Error("not on Connections")
}
}
+15 -4
View File
@@ -4,18 +4,29 @@
<section class="card"> <section class="card">
<h2>Federated Core</h2> <h2>Federated Core</h2>
{{if .Server}}
<form method="post" action="/settings/core" class="cols">
<label>The Core's domain <input name="domain" value="{{with .Core}}{{.Domain}}{{end}}" placeholder="example.com"></label>
<label>The Core account Hermes works for <input type="email" name="email" value="{{with .Core}}{{.Email}}{{end}}" placeholder="you@example.com"></label>
<div><button type="submit">Save</button> <span class="help">Empty: no Core. Supermarket never holds the Core's admin credentials.</span></div>
</form>
{{end}}
{{if .Core}} {{if .Core}}
<p><strong>{{.Core.Domain}}</strong> · {{.Core.Email}}{{if .Core.Name}} · {{.Core.Name}}{{end}}</p> <p><strong>{{.Core.Domain}}</strong> · {{.Core.Email}}{{if .Core.Name}} · {{.Core.Name}}{{end}}</p>
<p class="help">From CoreDesktop's <code>configure core</code>. To use another Core, change it there and run <code>update</code>.</p> {{if not .Server}}<p class="help">From CoreDesktop's <code>configure core</code>. To use another Core, change it there and run <code>update</code>.</p>{{end}}
<div hx-get="/settings/core/checks" hx-trigger="load" hx-swap="outerHTML"><p class="help">Checking the Core's services…</p></div> <div hx-get="/settings/core/checks" hx-trigger="load" hx-swap="outerHTML"><p class="help">Checking the Core's services…</p></div>
{{else}} {{else if not .Server}}
<p>No Core found. Run <code>configure core</code> in CoreDesktop, then <code>update</code>. Without a Core, everything works except EspoCRM, Plausible and publishing through Gitea.</p> <p>No Core found. Run <code>configure core</code> in CoreDesktop, then <code>update</code>. Without a Core, everything works except EspoCRM, Plausible and publishing through Gitea.</p>
{{end}} {{end}}
</section> </section>
<section class="card"> <section class="card">
<h2>Hermes bridge</h2> <h2>Hermes bridge</h2>
{{if .Server}}
<p>Hermes, on your side, is the only thing that talks to your Core's MCP hub. Make it an agent under <a href="/settings/agents">Settings → Agents</a> with <em>CRM through the Core</em> (read and act), then give Hermes the agent's key and <code>{{.MCPURL}}</code> (streamable HTTP, <code>Authorization: Bearer &lt;key&gt;</code>).</p>
{{else}}
<p>Hermes, CoreDesktop's agent, is the only thing that talks to your Core's MCP hub. It reaches Supermarket through the socket <code>{{.MCPSocket}}</code>; other agents, such as Claude Code, use <code>{{.MCPURL}}</code> with the MCP token.</p> <p>Hermes, CoreDesktop's agent, is the only thing that talks to your Core's MCP hub. It reaches Supermarket through the socket <code>{{.MCPSocket}}</code>; other agents, such as Claude Code, use <code>{{.MCPURL}}</code> with the MCP token.</p>
{{end}}
{{with .Last}} {{with .Last}}
<p class="ok">Hermes last checked in {{ago .At}}.{{if .Note}} It said: “{{.Note}}”{{end}}</p> <p class="ok">Hermes last checked in {{ago .At}}.{{if .Note}} It said: “{{.Note}}”{{end}}</p>
{{if .MCPHubTools}} {{if .MCPHubTools}}
@@ -33,14 +44,14 @@
<p class="help">Then reload this page.</p> <p class="help">Then reload this page.</p>
</section> </section>
<details class="card"> {{if not .Server}}<details class="card">
<summary>Set up Hermes by hand</summary> <summary>Set up Hermes by hand</summary>
<p><code>install.sh</code> does this for you. To do it yourself, add this to <code>~/.hermes/config.yaml</code>:</p> <p><code>install.sh</code> does this for you. To do it yourself, add this to <code>~/.hermes/config.yaml</code>:</p>
<div class="copy"><pre id="hermes-config">{{.HermesConfig}}</pre><button type="button" class="secondary" data-copy="hermes-config">Copy</button></div> <div class="copy"><pre id="hermes-config">{{.HermesConfig}}</pre><button type="button" class="secondary" data-copy="hermes-config">Copy</button></div>
<p>and this to <code>~/.hermes/.env</code>, so no password is in <code>config.yaml</code>:</p> <p>and this to <code>~/.hermes/.env</code>, so no password is in <code>config.yaml</code>:</p>
<pre>{{.HermesEnv}}</pre> <pre>{{.HermesEnv}}</pre>
<p>Hermes runs in CoreDesktop's sandbox, so also let it reach the hub: add <code>mcphub.{{if .Core}}{{.Core.Domain}}{{else}}&lt;your Core's domain&gt;{{end}}</code> to <code>network.allowedDomains</code> in <code>~/.config/coredesktop/sandbox/hermes.json</code>. Then restart Hermes' gateway: <code>systemctl --user restart hermes-gateway</code>.</p> <p>Hermes runs in CoreDesktop's sandbox, so also let it reach the hub: add <code>mcphub.{{if .Core}}{{.Core.Domain}}{{else}}&lt;your Core's domain&gt;{{end}}</code> to <code>network.allowedDomains</code> in <code>~/.config/coredesktop/sandbox/hermes.json</code>. Then restart Hermes' gateway: <code>systemctl --user restart hermes-gateway</code>.</p>
<details><summary>Show the MCP token</summary><pre>{{.MCPToken}}</pre><p class="help">Also in <code>mcp-token</code> in the data folder.</p></details> <details><summary>Show the MCP token</summary><pre>{{.MCPToken}}</pre><p class="help">Also in <code>mcp-token</code> in the data folder.</p></details>{{end}}
</details> </details>
{{end}}{{template "settings-end"}}{{end}} {{end}}{{template "settings-end"}}{{end}}
+2 -2
View File
@@ -37,8 +37,8 @@ func (s *Server) plausibleURL() string {
if _, err := s.DB.GetJSON(plausibleURLKey, &u); err == nil && u != "" { if _, err := s.DB.GetJSON(plausibleURLKey, &u); err == nil && u != "" {
return u return u
} }
if s.Core != nil && s.Core.Domain != "" { if s.core() != nil && s.core().Domain != "" {
return "https://plausible." + s.Core.Domain return "https://plausible." + s.core().Domain
} }
return "https://plausible.io" return "https://plausible.io"
} }