Skip to content

Commit

Permalink
readme update + global log_level is not fetched from "log_level" inst…
Browse files Browse the repository at this point in the history
…ead of "logging/log_level"
  • Loading branch information
rsms committed Sep 6, 2009
1 parent 763370e commit 9089af5
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 7 deletions.
34 changes: 31 additions & 3 deletions README.md
Expand Up @@ -11,11 +11,39 @@ Start a server in a terminal:

$ cometpsd -k xyz

Open [http://localhost:8080/channel](http://localhost:8080/channel) in your web browser.
Open [http://localhost:8080/channel/default](http://localhost:8080/channel/default) in your web browser.

In another terminal, use curl to publish something:

$ curl -i -X POST -H 'X-CPS-Publish-Key: xyz' \
--data-binary '<p>hello</p>' localhost:8080/channel
--data-binary '<p>hello</p>' localhost:8080/channel/default

"hello" should appear in your browser when you run the command above. Open more tabs with [http://localhost:8080/channel/default](http://localhost:8080/channel/default)
and run the curl command a few more times.


## Configuration file

The server can be configured by a YAML file (passing filename, or "-" for stdin, with `-f` flag)
which can describe multiple servers, which in turn each can describe multiple channels.

Parameters like `address`, `port` and `log_level` are hierarchical
-- i.e. specifying `log_level 3` for a server will implicitly set `log_level 3` for all
its channels which do not themselves set `log_level`.

### Example

servers:
- address: "0.0.0.0" # ANY
port: 8080
channels:
test:
publish_key: xyz
log_level: 3
test2:
max_clients: 3

- port: 8081
log_level: 2
channels: {a: {publish_key: xyz}, b: {}}

"hello" should appear in your browser when you run the command above. Open more tabs with [http://localhost:8080/channel](http://localhost:8080/channel) and run the curl command a few more times.
2 changes: 1 addition & 1 deletion cometpsd.c
Expand Up @@ -489,7 +489,7 @@ int main(int argc, char **argv) {
// load configuration file
if (config_file) {
yconf_load(&config, config_file);
log_level += 1 - (int)yconf_get_int(&config, "logging/log_level", (long long)log_level);
log_level += 1 - (int)yconf_get_int(&config, "log_level", (long long)log_level);
//printf("config: servers/0/address => %s\n",
// yconf_get_str(&config, "servers/0/address", "?"));
//printf("config: servers/1/channels/test2/max_clients => %lld\n",
Expand Down
4 changes: 1 addition & 3 deletions cometpsd.yml
@@ -1,6 +1,4 @@
logging:
log_level: 1

log_level: 1
servers:
- address: "0.0.0.0" # ANY
port: 8080
Expand Down

0 comments on commit 9089af5

Please sign in to comment.