Add district settings management
This commit is contained in:
1 parent
8a2ac56844
commit
b37427535c
5 files changed
+627
-2
No files matched your search
@@ -1,6 +1,10 @@
|
||||
package server
|
||||
|
||||
import "pageswiki/internal/store"
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"pageswiki/internal/store"
|
||||
)
|
||||
|
||||
func (s *Server) currentDistrict() *store.District {
|
||||
|
||||
@@ -18,3 +22,23 @@ func (s *Server) currentDistrict() *store.District {
|
||||
|
||||
return sp
|
||||
}
|
||||
|
||||
func (s *Server) districtForRequest(
|
||||
r *http.Request,
|
||||
) *store.District {
|
||||
|
||||
if r == nil {
|
||||
return s.currentDistrict()
|
||||
}
|
||||
|
||||
sp, err :=
|
||||
s.store.GetDistrictByHost(
|
||||
r.Host,
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
return s.currentDistrict()
|
||||
}
|
||||
|
||||
return sp
|
||||
}
|
||||
Reference in new issue
Block a user