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
bcea5182
Commit
bcea5182
authored
Nov 05, 2015
by
Matthew Holt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't truncate process log; more consistent output
parent
2fb4810c
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
23 additions
and
24 deletions
+23
-24
caddy/config.go
caddy/config.go
+1
-1
caddy/letsencrypt/maintain.go
caddy/letsencrypt/maintain.go
+7
-7
caddy/restart.go
caddy/restart.go
+1
-1
caddy/setup/root.go
caddy/setup/root.go
+1
-1
caddy/setup/tls.go
caddy/setup/tls.go
+1
-1
caddy/sigtrap.go
caddy/sigtrap.go
+1
-1
caddy/sigtrap_posix.go
caddy/sigtrap_posix.go
+1
-1
dist/CHANGES.txt
dist/CHANGES.txt
+1
-0
main.go
main.go
+2
-2
middleware/markdown/markdown.go
middleware/markdown/markdown.go
+1
-1
middleware/markdown/page.go
middleware/markdown/page.go
+1
-1
middleware/markdown/process.go
middleware/markdown/process.go
+3
-4
middleware/markdown/watcher.go
middleware/markdown/watcher.go
+1
-1
server/server.go
server/server.go
+1
-2
No files found.
caddy/config.go
View file @
bcea5182
...
...
@@ -226,7 +226,7 @@ func arrangeBindings(allConfigs []server.Config) (Group, error) {
return
groupings
,
fatalErr
}
if
warnErr
!=
nil
{
log
.
Print
ln
(
"[Warning]"
,
warnErr
)
log
.
Print
f
(
"[WARNING] Resolving bind address for %s: %v"
,
conf
.
Address
()
,
warnErr
)
}
// Make sure to compare the string representation of the address,
...
...
caddy/letsencrypt/maintain.go
View file @
bcea5182
...
...
@@ -36,24 +36,24 @@ func maintainAssets(configs []server.Config, stopChan chan struct{}) {
n
,
errs
:=
renewCertificates
(
configs
,
true
)
if
len
(
errs
)
>
0
{
for
_
,
err
:=
range
errs
{
log
.
Printf
(
"[ERROR]
cert renewal: %v
\n
"
,
err
)
log
.
Printf
(
"[ERROR]
Certificate renewal: %v
"
,
err
)
}
}
// even if there was an error, some renewals may have succeeded
if
n
>
0
&&
OnChange
!=
nil
{
err
:=
OnChange
()
if
err
!=
nil
{
log
.
Printf
(
"[ERROR]
onchange after cert renewal: %v
\n
"
,
err
)
log
.
Printf
(
"[ERROR]
OnChange after cert renewal: %v
"
,
err
)
}
}
case
<-
ocspTicker
.
C
:
for
bundle
,
oldStatus
:=
range
ocspStatus
{
_
,
newStatus
,
err
:=
acme
.
GetOCSPForCert
(
*
bundle
)
if
err
==
nil
&&
newStatus
!=
oldStatus
&&
OnChange
!=
nil
{
log
.
Printf
(
"[INFO]
ocsp status changed from %v to %v
\n
"
,
oldStatus
,
newStatus
)
log
.
Printf
(
"[INFO]
OCSP status changed from %v to %v
"
,
oldStatus
,
newStatus
)
err
:=
OnChange
()
if
err
!=
nil
{
log
.
Printf
(
"[ERROR]
onchange after ocsp update: %v
\n
"
,
err
)
log
.
Printf
(
"[ERROR]
OnChange after OCSP update: %v
"
,
err
)
}
break
}
...
...
@@ -75,7 +75,7 @@ func maintainAssets(configs []server.Config, stopChan chan struct{}) {
// whatever is listening at 443 better proxy ACME requests to it.
// Otherwise, the acme package will create its own listener on 443.
func
renewCertificates
(
configs
[]
server
.
Config
,
useCustomPort
bool
)
(
int
,
[]
error
)
{
log
.
Print
(
"[INFO] Processing certificate renewals..."
)
log
.
Print
f
(
"[INFO] Checking certificates for %d hosts"
,
len
(
configs
)
)
var
errs
[]
error
var
n
int
...
...
@@ -110,7 +110,7 @@ func renewCertificates(configs []server.Config, useCustomPort bool) (int, []erro
// Renew with two weeks or less remaining.
if
daysLeft
<=
14
{
log
.
Printf
(
"[INFO]
There are %d days left on the certificate of %s. Trying to renew now."
,
daysLeft
,
cfg
.
Hos
t
)
log
.
Printf
(
"[INFO]
Certificate for %s has %d days remaining; attempting renewal"
,
cfg
.
Host
,
daysLef
t
)
var
client
*
acme
.
Client
if
useCustomPort
{
client
,
err
=
newClientPort
(
""
,
alternatePort
)
// email not used for renewal
...
...
@@ -170,7 +170,7 @@ func renewCertificates(configs []server.Config, useCustomPort bool) (int, []erro
n
++
}
else
if
daysLeft
<=
30
{
// Warn on 30 days remaining. TODO: Just do this once...
log
.
Printf
(
"[WARN
] There are %d days left on the certificate for %s. Will renew when 14 days remain.
\n
"
,
daysLeft
,
cfg
.
Hos
t
)
log
.
Printf
(
"[WARN
ING] Certificate for %s has %d days remaining; will automatically renew when 14 days remain
\n
"
,
cfg
.
Host
,
daysLef
t
)
}
}
...
...
caddy/restart.go
View file @
bcea5182
...
...
@@ -93,7 +93,7 @@ func Restart(newCaddyfile Input) error {
sigwpipe
.
Close
()
// close our copy of the write end of the pipe or we might be stuck
answer
,
err
:=
ioutil
.
ReadAll
(
sigrpipe
)
if
err
!=
nil
||
len
(
answer
)
==
0
{
log
.
Println
(
"
r
estart: child failed to initialize; changes not applied"
)
log
.
Println
(
"
[ERROR] R
estart: child failed to initialize; changes not applied"
)
return
errIncompleteRestart
}
...
...
caddy/setup/root.go
View file @
bcea5182
...
...
@@ -22,7 +22,7 @@ func Root(c *Controller) (middleware.Middleware, error) {
if
os
.
IsNotExist
(
err
)
{
// Allow this, because the folder might appear later.
// But make sure the user knows!
log
.
Printf
(
"
Warning:
Root path does not exist: %s"
,
c
.
Root
)
log
.
Printf
(
"
[WARNING]
Root path does not exist: %s"
,
c
.
Root
)
}
else
{
return
nil
,
c
.
Errf
(
"Unable to access root path '%s': %v"
,
c
.
Root
,
err
)
}
...
...
caddy/setup/tls.go
View file @
bcea5182
...
...
@@ -13,7 +13,7 @@ import (
func
TLS
(
c
*
Controller
)
(
middleware
.
Middleware
,
error
)
{
if
c
.
Port
==
"http"
{
c
.
TLS
.
Enabled
=
false
log
.
Printf
(
"
Warning:
TLS disabled for %s://%s. To force TLS over the plaintext HTTP port, "
+
log
.
Printf
(
"
[WARNING]
TLS disabled for %s://%s. To force TLS over the plaintext HTTP port, "
+
"specify port 80 explicitly (https://%s:80)."
,
c
.
Port
,
c
.
Host
,
c
.
Host
)
}
else
{
c
.
TLS
.
Enabled
=
true
// they had a tls directive, so assume it's on unless we confirm otherwise later
...
...
caddy/sigtrap.go
View file @
bcea5182
...
...
@@ -23,7 +23,7 @@ func init() {
if
len
(
errs
)
>
0
{
for
_
,
err
:=
range
errs
{
log
.
Print
ln
(
err
)
log
.
Print
f
(
"[ERROR] Shutting down: %v"
,
err
)
}
exitCode
=
1
}
...
...
caddy/sigtrap_posix.go
View file @
bcea5182
...
...
@@ -42,7 +42,7 @@ func init() {
err
:=
Restart
(
updatedCaddyfile
)
if
err
!=
nil
{
log
.
Print
ln
(
"error at restart:
"
,
err
)
log
.
Print
f
(
"[ERROR] SIGUSR1: Restart returned: %v
"
,
err
)
}
}
}()
...
...
dist/CHANGES.txt
View file @
bcea5182
...
...
@@ -9,6 +9,7 @@ CHANGES
- New -email flag to customize default email used for ACME transactions
- New -ca flag to customize ACME CA server URL
- New -revoke flag to revoke a certificate
- New -log flag to enable process log
- browse: Render filenames with multiple whitespace properly
- markdown: Include Last-Modified header in response
- startup, shutdown: Better Windows support
...
...
main.go
View file @
bcea5182
...
...
@@ -62,7 +62,7 @@ func main() {
case
""
:
log
.
SetOutput
(
ioutil
.
Discard
)
default
:
file
,
err
:=
os
.
Create
(
logfile
)
file
,
err
:=
os
.
OpenFile
(
logfile
,
os
.
O_RDWR
|
os
.
O_CREATE
|
os
.
O_APPEND
,
0644
)
if
err
!=
nil
{
log
.
Fatalf
(
"Error opening log file: %v"
,
err
)
}
...
...
@@ -98,7 +98,7 @@ func main() {
err
=
caddy
.
Start
(
caddyfile
)
if
err
!=
nil
{
if
caddy
.
IsRestart
()
{
log
.
Print
ln
(
"error starting servers:"
,
err
)
log
.
Print
f
(
"[ERROR] Upon starting %s: %v"
,
appName
,
err
)
}
else
{
mustLogFatal
(
err
)
}
...
...
middleware/markdown/markdown.go
View file @
bcea5182
...
...
@@ -122,7 +122,7 @@ func (md Markdown) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error
// if development is set, scan directory for file changes for links.
if
cfg
.
Development
{
if
err
:=
GenerateStatic
(
md
,
cfg
);
err
!=
nil
{
log
.
Print
ln
(
"On-demand generation error (markdown):
"
,
err
)
log
.
Print
f
(
"[ERROR] markdown: on-demand site generation error: %v
"
,
err
)
}
}
...
...
middleware/markdown/page.go
View file @
bcea5182
...
...
@@ -92,7 +92,7 @@ func (l *linkGen) generateLinks(md Markdown, cfg *Config) bool {
l
.
Unlock
()
return
false
}
else
if
err
!=
nil
{
log
.
Print
ln
(
"Hash error (markdown):
"
,
err
)
log
.
Print
f
(
"[ERROR] markdown: Hash error: %v
"
,
err
)
}
cfg
.
Links
=
[]
PageLink
{}
...
...
middleware/markdown/process.go
View file @
bcea5182
...
...
@@ -115,10 +115,9 @@ func (md Markdown) processTemplate(c *Config, requestPath string, tmpl []byte, m
// generate static page
if
err
=
md
.
generatePage
(
c
,
requestPath
,
b
.
Bytes
());
err
!=
nil
{
// if static page generation fails,
// nothing fatal, only log the error.
// TODO: Report this non-fatal error, but don't log it here
log
.
Println
(
"Rendering error (markdown):"
,
err
)
// if static page generation fails, nothing fatal, only log the error.
// TODO: Report (return) this non-fatal error, but don't log it here?
log
.
Println
(
"[ERROR] markdown: Render:"
,
err
)
}
return
b
.
Bytes
(),
nil
...
...
middleware/markdown/watcher.go
View file @
bcea5182
...
...
@@ -14,7 +14,7 @@ const DefaultInterval = time.Second * 60
func
Watch
(
md
Markdown
,
c
*
Config
,
interval
time
.
Duration
)
(
stopChan
chan
struct
{})
{
return
TickerFunc
(
interval
,
func
()
{
if
err
:=
GenerateStatic
(
md
,
c
);
err
!=
nil
{
log
.
Print
ln
(
err
)
log
.
Print
f
(
"[ERROR] markdown: Re-generating static site: %v"
,
err
)
}
})
}
...
...
server/server.go
View file @
bcea5182
...
...
@@ -266,8 +266,7 @@ func (s *Server) Stop() error {
err
:=
s
.
listener
.
Close
()
s
.
listenerMu
.
Unlock
()
if
err
!=
nil
{
// TODO: Better logging
log
.
Println
(
err
)
log
.
Printf
(
"[ERROR] Closing listener for %s: %v"
,
s
.
Addr
,
err
)
}
return
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