1+ import logging
2+
13from .exceptions import ConfigError
24
5+ logger = logging .getLogger (__name__ )
6+
37
48class Node (object ):
59 def __init__ (self , host , port , path , protocol ):
@@ -17,6 +21,7 @@ def url(self):
1721
1822class Configuration (object ):
1923 def __init__ (self , config_dict ):
24+ Configuration .show_deprecation_warnings (config_dict )
2025 Configuration .validate_config_dict (config_dict )
2126
2227 node_dicts = config_dict .get ('nodes' , [])
@@ -59,3 +64,15 @@ def validate_config_dict(config_dict):
5964 def validate_node_fields (node ):
6065 expected_fields = {'host' , 'port' , 'protocol' }
6166 return expected_fields .issubset (node )
67+
68+ @staticmethod
69+ def show_deprecation_warnings (config_dict ):
70+ if config_dict .get ('timeout_seconds' ):
71+ logger .warn ('Deprecation warning: timeout_seconds is now renamed to connection_timeout_seconds' )
72+
73+ if config_dict .get ('master_node' ):
74+ logger .warn ('Deprecation warning: master_node is now consolidated to nodes, starting with Typesense Server v0.12' )
75+
76+ if config_dict .get ('read_replica_nodes' ):
77+ logger .warn ('Deprecation warning: read_replica_nodes is now consolidated to nodes, starting with Typesense Server v0.12' )
78+
0 commit comments