Built-In configuration for zerogw

17 views
Skip to first unread message

Bogdan Glinskiy

unread,
Nov 25, 2014, 2:06:48 PM11/25/14
to zer...@googlegroups.com
Hello.

My application will use zerogw. But i want to build in zerogw server into my app and run it in a function in a thread. Is it possible to build in .yaml configuration file into program? Or i should read it each time from a disk? I know, that i can specify my conf file in these lines

main.c
config_main_t config;
config_load
(&config, argc, argv);

by setting argc and argv manually. But i don't know, how to build in .yaml file source into the program.

Paul Colomiets

unread,
Nov 25, 2014, 2:58:02 PM11/25/14
to zer...@googlegroups.com
Hi,
Well, it's quite deep in the code. Going down through the chain
`config_load -> coyaml_readfile_or_exit -> coyaml_readfile`, it seems
that
you need to clone coyaml_readfile function and change `open_file` to
something that's calls yaml_parser_set_input_string instead
yaml_parser_set_input_file.

While `config_load` and `coyaml_readfile_or_exit` are just shortcuts,
and you're expected to copy the code and change it, if you need. The
`coyaml_readfile` function is not. Probably you can decompose/fix it
to support your use case and send a pull request.

--
Paul
Reply all
Reply to author
Forward
0 new messages