Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
caddy
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
caddy
Commits
e8006acf
Commit
e8006acf
authored
Nov 03, 2015
by
Matthew Holt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix -port, -host, and -root flags when Caddyfile is missing
parent
295d21f3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
7 deletions
+10
-7
caddy/caddy.go
caddy/caddy.go
+1
-6
caddy/config.go
caddy/config.go
+8
-0
main.go
main.go
+1
-1
No files found.
caddy/caddy.go
View file @
e8006acf
...
...
@@ -42,11 +42,6 @@ var (
// If true, initialization will not show any informative output.
Quiet
bool
// DefaultInput is the default configuration to use when config input is empty or missing.
DefaultInput
=
CaddyfileInput
{
Contents
:
[]
byte
(
fmt
.
Sprintf
(
"%s:%s
\n
root %s"
,
DefaultHost
,
DefaultPort
,
DefaultRoot
)),
}
// HTTP2 indicates whether HTTP2 is enabled or not
HTTP2
bool
// TODO: temporary flag until http2 is standard
)
...
...
@@ -297,7 +292,7 @@ func LoadCaddyfile(loader func() (Input, error)) (cdyfile Input, err error) {
// Otherwise revert to default
if
cdyfile
==
nil
{
cdyfile
=
DefaultInput
cdyfile
=
DefaultInput
()
}
return
...
...
caddy/config.go
View file @
e8006acf
...
...
@@ -335,6 +335,14 @@ func NewDefault() server.Config {
}
}
// DefaultInput returns the default Caddyfile input
// to use when it is otherwise empty or missing.
func
DefaultInput
()
CaddyfileInput
{
return
CaddyfileInput
{
Contents
:
[]
byte
(
fmt
.
Sprintf
(
"%s:%s
\n
root %s"
,
Host
,
Port
,
Root
)),
}
}
// These defaults are configurable through the command line
var
(
// Site root
...
...
main.go
View file @
e8006acf
...
...
@@ -113,7 +113,7 @@ func loadCaddyfile() (caddy.Input, error) {
contents
,
err
:=
ioutil
.
ReadFile
(
caddy
.
DefaultConfigFile
)
if
err
!=
nil
{
if
os
.
IsNotExist
(
err
)
{
return
caddy
.
DefaultInput
,
nil
return
caddy
.
DefaultInput
()
,
nil
}
return
nil
,
err
}
...
...
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