]>
Commit | Line | Data |
---|---|---|
0312f226 RBR |
1 | # Nginx Office Hours |
2 | ||
31993a16 BB |
3 | A victory for the server's labor rights: An nginx module that allows you to serve your content only during office hours. |
4 | ||
5 | ## Using the directive | |
6 | ||
7 | The `office_hours` directive expects a list of time ranges sepaarated by | |
8 | spaces. The first range will be used as the default, and the rest will | |
9 | be read from right to left, ending with *sunday* | |
10 | ||
11 | ### Example 1: Open 24 hours | |
12 | ||
13 | Don't use this directive. | |
14 | ||
15 | ### Example 2: Open every day from 08:30 AM to 7:00 PM | |
16 | ||
17 | ``` | |
18 | office_hours 8:30-19; | |
19 | ``` | |
20 | ||
21 | Some things worth noting here: the format of time ranges uses 24 hour | |
22 | style, so no pesky AMs or PMs. Likewise, minutes are optional. Finally, | |
23 | note that since only one range was defined, this is applied to all days | |
24 | of the week. Another noteworthy | |
25 | ||
26 | ### Example 3: Open every day from 08:30 AM to 7:00 PM, but closed sundays | |
27 | ||
28 | ``` | |
29 | office_hours 8:30-19 closed; | |
30 | ``` | |
31 | ||
32 | Two important things here: first notice that the closed keyword | |
33 | specifies that the server is closed on a specific day; second, notice | |
34 | how the last element is used for sunday, while the first one still | |
35 | applies to Monday-Saturday. | |
36 | ||
37 | ### Example 4: Open weekdays from 08:30 AM to 7:00 PM, Saturdays 10:00 AM to 4:00 PM, closed on sundays | |
38 | ||
39 | ``` | |
40 | office_hours 8:30-19 10-16 closed; | |
41 | ``` | |
42 | ||
43 | Now hopefully you can see the pattern: The first time range applies to | |
44 | Monday-Friday, next one to Saturday and last one to Sunday. | |
45 | ||
46 | ### Example 5: Open weekdays from 08:30 AM to 7:00 PM, closed on thursdays, reduced hours on weekends. | |
47 | ||
48 | ``` | |
49 | office_hours 8:30-19 closed 8:30-19 10-16 10-16; | |
50 | ``` | |
51 | ||
52 | Since we had to specify from Thursday, we have to explicitly set the | |
53 | values for Friday, Saturday and Sunday. | |
54 | ||
55 | ### Example 6: Closed every day. | |
56 | ||
57 | Uninstall nginx. | |
58 | ||
59 | ## What you will need to get started | |
60 | ||
61 | I'm still not sure! I'm learning how to build this nginx module, so I'll | |
62 | figure it out as I go and add it here. | |
63 | ||
900e0f4a BB |
64 | ## Installing git hooks |
65 | ||
66 | This repo contains a pre-commit git hook so indent will run before every | |
67 | commit. Run `make setup_hooks` to install it. | |
68 | ||
31993a16 BB |
69 | ## Further Improvements |
70 | ||
71 | * Add support for public holidays | |
72 | * Add support to respect the time zone of the visitor and not just the | |
73 | server | |
74 | * Add support for double shifts in the same day |