add flag for toggling usage of alias subdomains
related to #160, requested by cryptix
This commit is contained in:
parent
1c5c0b9867
commit
8d1f790f57
|
@ -4,6 +4,7 @@ CREATE TABLE config (
|
||||||
id integer NOT NULL PRIMARY KEY,
|
id integer NOT NULL PRIMARY KEY,
|
||||||
privacyMode integer NOT NULL, -- open, community, restricted
|
privacyMode integer NOT NULL, -- open, community, restricted
|
||||||
defaultLanguage TEXT NOT NULL, -- a language tag, e.g. en, sv, de
|
defaultLanguage TEXT NOT NULL, -- a language tag, e.g. en, sv, de
|
||||||
|
use_subdomain_for_aliases boolean NOT NULL, -- flag to toggle using subdomains (rather than alias routes) for aliases
|
||||||
|
|
||||||
CHECK (id == 0) -- should only ever store one row
|
CHECK (id == 0) -- should only ever store one row
|
||||||
);
|
);
|
||||||
|
@ -11,10 +12,11 @@ CREATE TABLE config (
|
||||||
-- the config table will only ever contain one row: the rooms current settings
|
-- the config table will only ever contain one row: the rooms current settings
|
||||||
-- we update that row whenever the config changes.
|
-- we update that row whenever the config changes.
|
||||||
-- to have something to update, we insert the first and only row at id 0
|
-- to have something to update, we insert the first and only row at id 0
|
||||||
INSERT INTO config (id, privacyMode, defaultLanguage) VALUES (
|
INSERT INTO config (id, privacyMode, defaultLanguage, use_subdomain_for_aliases) VALUES (
|
||||||
0, -- the constant id we will query
|
0, -- the constant id we will query
|
||||||
2, -- community is the default mode unless overridden
|
2, -- community is the default mode unless overridden
|
||||||
"en" -- english is the default language for all installs
|
"en", -- english is the default language for all installs
|
||||||
|
1 -- use subdomain for aliases
|
||||||
);
|
);
|
||||||
|
|
||||||
-- +migrate Down
|
-- +migrate Down
|
||||||
|
|
|
@ -23,22 +23,25 @@ import (
|
||||||
|
|
||||||
// Config is an object representing the database table.
|
// Config is an object representing the database table.
|
||||||
type Config struct {
|
type Config struct {
|
||||||
ID int64 `boil:"id" json:"id" toml:"id" yaml:"id"`
|
ID int64 `boil:"id" json:"id" toml:"id" yaml:"id"`
|
||||||
PrivacyMode roomdb.PrivacyMode `boil:"privacyMode" json:"privacyMode" toml:"privacyMode" yaml:"privacyMode"`
|
PrivacyMode roomdb.PrivacyMode `boil:"privacyMode" json:"privacyMode" toml:"privacyMode" yaml:"privacyMode"`
|
||||||
DefaultLanguage string `boil:"defaultLanguage" json:"defaultLanguage" toml:"defaultLanguage" yaml:"defaultLanguage"`
|
DefaultLanguage string `boil:"defaultLanguage" json:"defaultLanguage" toml:"defaultLanguage" yaml:"defaultLanguage"`
|
||||||
|
UseSubdomainForAliases bool `boil:"use_subdomain_for_aliases" json:"use_subdomain_for_aliases" toml:"use_subdomain_for_aliases" yaml:"use_subdomain_for_aliases"`
|
||||||
|
|
||||||
R *configR `boil:"-" json:"-" toml:"-" yaml:"-"`
|
R *configR `boil:"-" json:"-" toml:"-" yaml:"-"`
|
||||||
L configL `boil:"-" json:"-" toml:"-" yaml:"-"`
|
L configL `boil:"-" json:"-" toml:"-" yaml:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
var ConfigColumns = struct {
|
var ConfigColumns = struct {
|
||||||
ID string
|
ID string
|
||||||
PrivacyMode string
|
PrivacyMode string
|
||||||
DefaultLanguage string
|
DefaultLanguage string
|
||||||
|
UseSubdomainForAliases string
|
||||||
}{
|
}{
|
||||||
ID: "id",
|
ID: "id",
|
||||||
PrivacyMode: "privacyMode",
|
PrivacyMode: "privacyMode",
|
||||||
DefaultLanguage: "defaultLanguage",
|
DefaultLanguage: "defaultLanguage",
|
||||||
|
UseSubdomainForAliases: "use_subdomain_for_aliases",
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generated where
|
// Generated where
|
||||||
|
@ -64,14 +67,25 @@ func (w whereHelperroomdb_PrivacyMode) GTE(x roomdb.PrivacyMode) qm.QueryMod {
|
||||||
return qmhelper.Where(w.field, qmhelper.GTE, x)
|
return qmhelper.Where(w.field, qmhelper.GTE, x)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type whereHelperbool struct{ field string }
|
||||||
|
|
||||||
|
func (w whereHelperbool) EQ(x bool) qm.QueryMod { return qmhelper.Where(w.field, qmhelper.EQ, x) }
|
||||||
|
func (w whereHelperbool) NEQ(x bool) qm.QueryMod { return qmhelper.Where(w.field, qmhelper.NEQ, x) }
|
||||||
|
func (w whereHelperbool) LT(x bool) qm.QueryMod { return qmhelper.Where(w.field, qmhelper.LT, x) }
|
||||||
|
func (w whereHelperbool) LTE(x bool) qm.QueryMod { return qmhelper.Where(w.field, qmhelper.LTE, x) }
|
||||||
|
func (w whereHelperbool) GT(x bool) qm.QueryMod { return qmhelper.Where(w.field, qmhelper.GT, x) }
|
||||||
|
func (w whereHelperbool) GTE(x bool) qm.QueryMod { return qmhelper.Where(w.field, qmhelper.GTE, x) }
|
||||||
|
|
||||||
var ConfigWhere = struct {
|
var ConfigWhere = struct {
|
||||||
ID whereHelperint64
|
ID whereHelperint64
|
||||||
PrivacyMode whereHelperroomdb_PrivacyMode
|
PrivacyMode whereHelperroomdb_PrivacyMode
|
||||||
DefaultLanguage whereHelperstring
|
DefaultLanguage whereHelperstring
|
||||||
|
UseSubdomainForAliases whereHelperbool
|
||||||
}{
|
}{
|
||||||
ID: whereHelperint64{field: "\"config\".\"id\""},
|
ID: whereHelperint64{field: "\"config\".\"id\""},
|
||||||
PrivacyMode: whereHelperroomdb_PrivacyMode{field: "\"config\".\"privacyMode\""},
|
PrivacyMode: whereHelperroomdb_PrivacyMode{field: "\"config\".\"privacyMode\""},
|
||||||
DefaultLanguage: whereHelperstring{field: "\"config\".\"defaultLanguage\""},
|
DefaultLanguage: whereHelperstring{field: "\"config\".\"defaultLanguage\""},
|
||||||
|
UseSubdomainForAliases: whereHelperbool{field: "\"config\".\"use_subdomain_for_aliases\""},
|
||||||
}
|
}
|
||||||
|
|
||||||
// ConfigRels is where relationship names are stored.
|
// ConfigRels is where relationship names are stored.
|
||||||
|
@ -91,8 +105,8 @@ func (*configR) NewStruct() *configR {
|
||||||
type configL struct{}
|
type configL struct{}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
configAllColumns = []string{"id", "privacyMode", "defaultLanguage"}
|
configAllColumns = []string{"id", "privacyMode", "defaultLanguage", "use_subdomain_for_aliases"}
|
||||||
configColumnsWithoutDefault = []string{"privacyMode", "defaultLanguage"}
|
configColumnsWithoutDefault = []string{"privacyMode", "defaultLanguage", "use_subdomain_for_aliases"}
|
||||||
configColumnsWithDefault = []string{"id"}
|
configColumnsWithDefault = []string{"id"}
|
||||||
configPrimaryKeyColumns = []string{"id"}
|
configPrimaryKeyColumns = []string{"id"}
|
||||||
)
|
)
|
||||||
|
|
|
@ -48,15 +48,6 @@ var InviteColumns = struct {
|
||||||
|
|
||||||
// Generated where
|
// Generated where
|
||||||
|
|
||||||
type whereHelperbool struct{ field string }
|
|
||||||
|
|
||||||
func (w whereHelperbool) EQ(x bool) qm.QueryMod { return qmhelper.Where(w.field, qmhelper.EQ, x) }
|
|
||||||
func (w whereHelperbool) NEQ(x bool) qm.QueryMod { return qmhelper.Where(w.field, qmhelper.NEQ, x) }
|
|
||||||
func (w whereHelperbool) LT(x bool) qm.QueryMod { return qmhelper.Where(w.field, qmhelper.LT, x) }
|
|
||||||
func (w whereHelperbool) LTE(x bool) qm.QueryMod { return qmhelper.Where(w.field, qmhelper.LTE, x) }
|
|
||||||
func (w whereHelperbool) GT(x bool) qm.QueryMod { return qmhelper.Where(w.field, qmhelper.GT, x) }
|
|
||||||
func (w whereHelperbool) GTE(x bool) qm.QueryMod { return qmhelper.Where(w.field, qmhelper.GTE, x) }
|
|
||||||
|
|
||||||
var InviteWhere = struct {
|
var InviteWhere = struct {
|
||||||
ID whereHelperint64
|
ID whereHelperint64
|
||||||
HashedToken whereHelperstring
|
HashedToken whereHelperstring
|
||||||
|
|
Loading…
Reference in New Issue