mirror of
https://github.com/hoernschen/dendrite.git
synced 2024-12-27 07:28:27 +00:00
11d9b9db0e
This removes most of the code used for polylith/API mode. This removes the `/api` internal endpoints entirely. Binary size change roughly 5%: ``` 51437560 Feb 13 10:15 dendrite-monolith-server # old 48759008 Feb 13 10:15 dendrite-monolith-server # new ```
48 lines
1.2 KiB
Go
48 lines
1.2 KiB
Go
package config
|
|
|
|
type SyncAPI struct {
|
|
Matrix *Global `yaml:"-"`
|
|
|
|
Database DatabaseOptions `yaml:"database,omitempty"`
|
|
|
|
RealIPHeader string `yaml:"real_ip_header"`
|
|
|
|
Fulltext Fulltext `yaml:"search"`
|
|
}
|
|
|
|
func (c *SyncAPI) Defaults(opts DefaultOpts) {
|
|
c.Fulltext.Defaults(opts)
|
|
if opts.Generate {
|
|
if !opts.SingleDatabase {
|
|
c.Database.ConnectionString = "file:syncapi.db"
|
|
}
|
|
}
|
|
}
|
|
|
|
func (c *SyncAPI) Verify(configErrs *ConfigErrors) {
|
|
c.Fulltext.Verify(configErrs)
|
|
if c.Matrix.DatabaseOptions.ConnectionString == "" {
|
|
checkNotEmpty(configErrs, "sync_api.database", string(c.Database.ConnectionString))
|
|
}
|
|
}
|
|
|
|
type Fulltext struct {
|
|
Enabled bool `yaml:"enabled"`
|
|
IndexPath Path `yaml:"index_path"`
|
|
InMemory bool `yaml:"in_memory"` // only useful in tests
|
|
Language string `yaml:"language"` // the language to use when analysing content
|
|
}
|
|
|
|
func (f *Fulltext) Defaults(opts DefaultOpts) {
|
|
f.Enabled = false
|
|
f.IndexPath = "./searchindex"
|
|
f.Language = "en"
|
|
}
|
|
|
|
func (f *Fulltext) Verify(configErrs *ConfigErrors) {
|
|
if !f.Enabled {
|
|
return
|
|
}
|
|
checkNotEmpty(configErrs, "syncapi.search.index_path", string(f.IndexPath))
|
|
checkNotEmpty(configErrs, "syncapi.search.language", f.Language)
|
|
}
|