Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
galene
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
galene
Commits
5e39c3a2
Commit
5e39c3a2
authored
Oct 26, 2021
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move -redirect into the configuration file.
parent
c0b30c85
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
7 deletions
+7
-7
README
README
+2
-0
galene.go
galene.go
+0
-2
group/group.go
group/group.go
+2
-1
webserver/webserver.go
webserver/webserver.go
+3
-4
No files found.
README
View file @
5e39c3a2
...
...
@@ -43,11 +43,13 @@ The server may be configured in the JSON file `data/config.json`. This
file may look as follows:
{
"canonicalHost: "galene.example.org",
"admin":[{"username":"root","password":"secret"}]
}
The fields are as follows:
- `canonicalHost`: the canonical name of the host running the server;
- `admin` defines the users allowed to look at the `/stats.html` file; it
has the same syntax as user definitions in groups (see below).
...
...
galene.go
View file @
5e39c3a2
...
...
@@ -27,8 +27,6 @@ func main() {
flag
.
StringVar
(
&
httpAddr
,
"http"
,
":8443"
,
"web server `address`"
)
flag
.
StringVar
(
&
webserver
.
StaticRoot
,
"static"
,
"./static/"
,
"web server root `directory`"
)
flag
.
StringVar
(
&
webserver
.
Redirect
,
"redirect"
,
""
,
"redirect to canonical `host`"
)
flag
.
BoolVar
(
&
webserver
.
Insecure
,
"insecure"
,
false
,
"act as an HTTP server rather than HTTPS"
)
flag
.
StringVar
(
&
group
.
DataDirectory
,
"data"
,
"./data/"
,
...
...
group/group.go
View file @
5e39c3a2
...
...
@@ -809,7 +809,8 @@ type Configuration struct {
modTime
time
.
Time
`json:"-"`
fileSize
int64
`json:"-"`
Admin
[]
ClientPattern
`json:"admin"`
CanonicalHost
string
`json:"canonicalHost"`
Admin
[]
ClientPattern
`json:"admin"`
}
var
configuration
struct
{
...
...
webserver/webserver.go
View file @
5e39c3a2
...
...
@@ -32,8 +32,6 @@ var server atomic.Value
var
StaticRoot
string
var
Redirect
string
var
Insecure
bool
func
Serve
(
address
string
,
dataDir
string
)
error
{
...
...
@@ -130,13 +128,14 @@ const (
)
func
redirect
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
bool
{
if
Redirect
==
""
||
strings
.
EqualFold
(
r
.
Host
,
Redirect
)
{
conf
,
err
:=
group
.
GetConfiguration
()
if
err
!=
nil
||
conf
.
CanonicalHost
==
""
{
return
false
}
u
:=
url
.
URL
{
Scheme
:
"https"
,
Host
:
Redirec
t
,
Host
:
conf
.
CanonicalHos
t
,
Path
:
r
.
URL
.
Path
,
}
http
.
Redirect
(
w
,
r
,
u
.
String
(),
http
.
StatusMovedPermanently
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment