| File was renamed from project/mosquitto/conf.c |
| | |
| | | * Copyright: (C) 2019 LingYun IoT System Studio |
| | | * All rights reserved. |
| | | * |
| | | * Filename: conf.c |
| | | * Filename: config.c |
| | | * Description: This file is mqttd configure file parser function |
| | | * |
| | | * Version: 1.0.0(2019年06月25日) |
| | |
| | | * ChangeLog: 1, Release initial version on "2019年06月25日 22时23分55秒" |
| | | * |
| | | ********************************************************************************/ |
| | | #include "conf.h" |
| | | #include "config.h" |
| | | #include "logger.h" |
| | | #include "iniparser.h" |
| | | |
| | | |
| | | int mqttd_parser_conf(const char *conf_file, mqtt_ctx_t *ctx, int debug) |
| | | { |
| | |
| | | *+------------------------------------------------------+*/ |
| | | if( !debug ) |
| | | { |
| | | str = iniparser_getstring(ini, "logger:file", "/tmp/mqttd.log"); |
| | | str = iniparser_getstring(ini, "logger:file", "/tmp/thingsboard.log"); |
| | | strncpy(ctx->logfile, str, sizeof(ctx->logfile)); |
| | | ctx->logsize = iniparser_getint(ini, "logger:size", 1024); |
| | | ctx->loglevel = iniparser_getint(ini, "logger:level", LOG_LEVEL_INFO); |
| | |
| | | ctx->port = val; |
| | | log_info("Parser MQTT broker server [%s:%d]\n", ctx->host, ctx->port); |
| | | |
| | | str=iniparser_getstring(ini, "broker:token", NULL); |
| | | strncpy(ctx->token, str, sizeof(ctx->uid) ); |
| | | |
| | | str=iniparser_getstring(ini, "broker:username", NULL); |
| | | strncpy(ctx->uid, str, sizeof(ctx->uid) ); |
| | | |