Commit Graph

22 Commits

Author SHA1 Message Date
Matthew Holt
2236780190 Add ServerBlockIndex and ServerBlockHosts to Controller
This way, Setup functions have access to the list of hosts that share the server block, and also, if needed for some reason, the index of the server block in the input
2015-10-15 23:34:54 -06:00
Matthew Holt
0c07f7adcc Epic revert of 0ac8bf5 and adding OncePerServerBlock
Turns out having each server block share a single server.Config during initialization when the Setup functions are being called was a bad idea. Sure, startup and shutdown functions were only executed once, but they had no idea what their hostname or port was. So here we revert to the old way of doing things where Setup may be called multiple times per server block (once per host associated with the block, to be precise), but the Setup functions now know their host and port since the config belongs to exactly one virtualHost. To have something happen just once per server block, use OncePerServerBlock, a new function available on each Controller.
2015-10-14 23:45:28 -06:00
Zac Bergquist
f9bc74626d Address various lint and gocyclo warnings. Fixes #253 2015-10-11 16:28:02 -04:00
Maxime
008160998a Added LogRoller parser and entity.
The errors and logs can now have log rolling if provided by the user.
The current customisable parameter of it are:
The maximal size of the file before rolling.
The maximal age/time of the file before rolling.
The number of backups to keep.
2015-09-02 15:13:31 +02:00
Matthew Holt
d8c50264cc Fix parser when address is empty token
Bug detected by go-fuzz (more fuzzing is required; need larger corpus)
2015-08-03 17:31:10 -06:00
Matthew Holt
0ac8bf58ea core: Run startup/shutdown functions only once
Even if defined for multiple hosts. Startup or shutdown callbacks registered by any directive (startup, shutdown, markdown, git, log, etc.) will only run as many times as it appears in the Caddyfile, not repeated for each host that shares that server block. Fixing this involved refactoring three packages (yeesh) and we need to restore some tests that are no longer valid (that used to verify splitting a multiServerBlock into multiple serverBlocks).
2015-08-01 13:08:31 -06:00
Matthew Holt
d3c229375c Fixed import command, added tests 2015-07-07 22:38:48 -06:00
Matthew Holt
674f454e70 t.Fatal -> t.Fatalf 2015-05-25 08:27:54 -06:00
Zac Bergquist
e4b50aa814 Fix more lint warnings 2015-05-24 22:52:34 -04:00
Matthew Holt
3420bd6e06 Another test case for parser 2015-05-21 23:50:37 -06:00
Matthew Holt
b10d846019 More parser tests 2015-05-21 23:36:17 -06:00
Matthew Holt
11ddb5c6ca Tests for the parser 2015-05-21 18:46:42 -06:00
Matthew Holt
b37fed4cc8 Beginning some tests for the parser 2015-05-21 16:31:01 -06:00
Matthew Holt
5397eef234 Added tests for allTokens 2015-05-21 15:42:49 -06:00
Matthew Holt
ee754b4a47 Bug fixes 2015-05-21 00:40:05 -06:00
Matthew Holt
5e8491cf7f Allow IPv6 address without port (fixes #80) 2015-05-20 20:15:39 -06:00
Matthew Holt
2501691ea4 lexer: Fixed backslashes in quoted strings (closes #65) 2015-05-08 10:32:57 -06:00
Matthew Holt
0dba8d406b NextBlock() doesn't enter an empty block 2015-05-07 13:10:00 -06:00
Matthew Holt
63ccc626f9 Fix parsing bug for one-line Caddyfiles 2015-05-06 08:58:15 -06:00
Matthew Holt
2dbd14b6dc Consistent app name/version info; pipe config data through stdin 2015-05-04 16:23:16 -06:00
Matthew Holt
088f41b334 Began adding tests 2015-05-04 12:04:14 -06:00
Matthew Holt
6029973bdc Major refactoring of middleware and parser in progress 2015-05-04 11:04:37 -06:00