Phase 13, part 7: the platform's own admin
The people running the multi-tenant service (SUPERMARKET_PLATFORM_ADMINS, with two-factor sign-in) see every team at /platform with its size, people and what failed lately, and can suspend or restore a team, resend its invitations and release its domain. They don't see a team's data unless they view as it: with a reason, for at most an hour, read-only, recorded in the team's own audit log. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -95,6 +95,9 @@ type Config struct {
|
||||
Storage Storage
|
||||
Mail *Mail // nil if not set
|
||||
PGBackups string // where the server's nightly dumps are, to list them; "" if not known
|
||||
// PlatformAdmins are the email addresses of the people running the
|
||||
// multi-tenant service (its /platform area).
|
||||
PlatformAdmins []string
|
||||
}
|
||||
|
||||
// Environment variables.
|
||||
@@ -117,6 +120,7 @@ const (
|
||||
EnvMailURL = "SUPERMARKET_MAIL_URL"
|
||||
EnvMailFrom = "SUPERMARKET_MAIL_FROM"
|
||||
EnvPGBackups = "SUPERMARKET_PG_BACKUPS"
|
||||
EnvPlatform = "SUPERMARKET_PLATFORM_ADMINS"
|
||||
)
|
||||
|
||||
// Load reads the settings through getenv (os.Getenv) and checks them. All
|
||||
@@ -211,6 +215,19 @@ func Load(getenv func(string) string) (*Config, error) {
|
||||
}
|
||||
|
||||
c.PGBackups = get(EnvPGBackups, "")
|
||||
for _, a := range strings.Split(get(EnvPlatform, ""), ",") {
|
||||
if a = strings.ToLower(strings.TrimSpace(a)); a == "" {
|
||||
continue
|
||||
}
|
||||
if _, err := mail.ParseAddress(a); err != nil {
|
||||
bad("%s: %q isn't an email address", EnvPlatform, a)
|
||||
continue
|
||||
}
|
||||
c.PlatformAdmins = append(c.PlatformAdmins, a)
|
||||
}
|
||||
if len(c.PlatformAdmins) > 0 && c.Edition != Multi {
|
||||
bad("%s is for the multi-tenant edition", EnvPlatform)
|
||||
}
|
||||
|
||||
if len(problems) > 0 {
|
||||
return c, errors.New(strings.Join(problems, "\n"))
|
||||
|
||||
Reference in New Issue
Block a user