@@ -99,12 +99,36 @@ int stns_load_config(char *filename, stns_conf_t *c)
9999 GET_TOML_BYKEY (gid_shift , toml_rtoi , 0 , TOML_NULL_OR_INT );
100100 GET_TOML_BYKEY (cache_ttl , toml_rtoi , 600 , TOML_NULL_OR_INT );
101101 GET_TOML_BYKEY (negative_cache_ttl , toml_rtoi , 10 , TOML_NULL_OR_INT );
102- GET_TOML_BYKEY (ssl_verify , toml_rtob , 1 , TOML_NULL_OR_INT );
102+
103+ // Load long type fields via temporary int variables
104+ int tmp_ssl_verify = 1 ;
105+ int tmp_request_timeout = 10 ;
106+ int tmp_http_location = 0 ;
107+
108+ if (0 != (raw = toml_raw_in (tab , "ssl_verify" ))) {
109+ if (0 != toml_rtob (raw , & tmp_ssl_verify )) {
110+ syslog (LOG_ERR , "%s(stns)[L%d] cannot parse toml file:%s key:ssl_verify" , __func__ , __LINE__ , filename );
111+ }
112+ }
113+ c -> ssl_verify = (long )tmp_ssl_verify ;
114+
115+ if (0 != (raw = toml_raw_in (tab , "request_timeout" ))) {
116+ if (0 != toml_rtoi (raw , & tmp_request_timeout )) {
117+ syslog (LOG_ERR , "%s(stns)[L%d] cannot parse toml file:%s key:request_timeout" , __func__ , __LINE__ , filename );
118+ }
119+ }
120+ c -> request_timeout = (long )tmp_request_timeout ;
121+
122+ if (0 != (raw = toml_raw_in (tab , "http_location" ))) {
123+ if (0 != toml_rtob (raw , & tmp_http_location )) {
124+ syslog (LOG_ERR , "%s(stns)[L%d] cannot parse toml file:%s key:http_location" , __func__ , __LINE__ , filename );
125+ }
126+ }
127+ c -> http_location = (long )tmp_http_location ;
128+
103129 GET_TOML_BYKEY (cache , toml_rtob , 1 , TOML_NULL_OR_INT );
104- GET_TOML_BYKEY (request_timeout , toml_rtoi , 10 , TOML_NULL_OR_INT );
105130 GET_TOML_BYKEY (request_retry , toml_rtoi , 3 , TOML_NULL_OR_INT );
106131 GET_TOML_BYKEY (request_locktime , toml_rtoi , 60 , TOML_NULL_OR_INT );
107- GET_TOML_BYKEY (http_location , toml_rtob , 0 , TOML_NULL_OR_INT );
108132
109133 TRIM_SLASH (api_endpoint )
110134 TRIM_SLASH (cache_dir )
0 commit comments