RaspberrPi project source code
guowenxue
3 days ago 4bb23da006f050c6014156c9aab675f37dda906a
project/thingsboard/config.c
File was renamed from project/mosquitto/conf.c
@@ -2,7 +2,7 @@
 *      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日)
@@ -10,10 +10,9 @@
 *      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)
{
@@ -42,7 +41,7 @@
     *+------------------------------------------------------+*/
    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);
@@ -145,6 +144,9 @@
    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) );