mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 06:30:05 +00:00 
			
		
		
		
	Add mapbox_api_key to settings
This commit is contained in:
		
							parent
							
								
									ba64627f5d
								
							
						
					
					
						commit
						a96e017917
					
				
					 7 changed files with 47 additions and 11 deletions
				
			
		|  | @ -92,7 +92,8 @@ bool FromJsonInt64(const boost::json::object& json, | |||
| bool FromJsonString(const boost::json::object& json, | ||||
|                     const std::string&         key, | ||||
|                     std::string&               value, | ||||
|                     const std::string&         defaultValue) | ||||
|                     const std::string&         defaultValue, | ||||
|                     size_t                     minLength) | ||||
| { | ||||
|    const boost::json::value* jv    = json.if_contains(key); | ||||
|    bool                      dirty = true; | ||||
|  | @ -102,7 +103,20 @@ bool FromJsonString(const boost::json::object& json, | |||
|       if (jv->is_string()) | ||||
|       { | ||||
|          value = boost::json::value_to<std::string>(*jv); | ||||
|          dirty = false; | ||||
| 
 | ||||
|          if (value.length() >= minLength) | ||||
|          { | ||||
|             dirty = false; | ||||
|          } | ||||
|          else | ||||
|          { | ||||
|             logger_->warn( | ||||
|                "{} is shorter than {} characters, setting to default: {}", | ||||
|                key, | ||||
|                minLength, | ||||
|                defaultValue); | ||||
|             value = defaultValue; | ||||
|          } | ||||
|       } | ||||
|       else | ||||
|       { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat