41
41
from __future__ import annotations
42
42
from typing import Dict , Union , Iterable
43
43
import os
44
- from configparser import ConfigParser , ExtendedInterpolation
45
44
from firebird .base .config import Config , StrOption , IntOption , BoolOption , EnumOption , \
46
- ConfigListOption , ListOption
45
+ ConfigListOption , ListOption , ConfigParser , EnvExtendedInterpolation
47
46
from .types import NetProtocol , DecfloatRound , DecfloatTraps
48
47
49
48
class ServerConfig (Config ): # pylint: disable=R0902
@@ -218,7 +217,7 @@ def read(self, filenames: Union[str, Iterable], encoding: str=None):
218
217
219
218
Return list of successfully read files.
220
219
"""
221
- parser = ConfigParser (interpolation = ExtendedInterpolation ())
220
+ parser = ConfigParser (interpolation = EnvExtendedInterpolation ())
222
221
read_ok = parser .read (filenames , encoding )
223
222
if read_ok :
224
223
self .load_config (parser )
@@ -228,13 +227,13 @@ def read_file(self, f):
228
227
229
228
The `f` argument must be iterable, returning one line at a time.
230
229
"""
231
- parser = ConfigParser (interpolation = ExtendedInterpolation ())
230
+ parser = ConfigParser (interpolation = EnvExtendedInterpolation ())
232
231
parser .read_file (f )
233
232
self .load_config (parser )
234
233
def read_string (self , string : str ) -> None :
235
234
"""Read configuration from a given string.
236
235
"""
237
- parser = ConfigParser (interpolation = ExtendedInterpolation ())
236
+ parser = ConfigParser (interpolation = EnvExtendedInterpolation ())
238
237
parser .read_string (string )
239
238
self .load_config (parser )
240
239
def read_dict (self , dictionary : Dict ) -> None :
@@ -247,7 +246,7 @@ def read_dict(self, dictionary: Dict) -> None:
247
246
All types held in the dictionary are converted to strings during
248
247
reading, including section names, option names and keys.
249
248
"""
250
- parser = ConfigParser (interpolation = ExtendedInterpolation ())
249
+ parser = ConfigParser (interpolation = EnvExtendedInterpolation ())
251
250
parser .read_dict (dictionary )
252
251
self .load_config (parser )
253
252
def get_server (self , name : str ) -> ServerConfig :
@@ -282,7 +281,7 @@ def register_server(self, name: str, config: str=None) -> ServerConfig:
282
281
srv_config = ServerConfig (name )
283
282
self .servers .value .append (srv_config )
284
283
if config :
285
- parser = ConfigParser (interpolation = ExtendedInterpolation ())
284
+ parser = ConfigParser (interpolation = EnvExtendedInterpolation ())
286
285
parser .read_string (config )
287
286
srv_config .load_config (parser , name )
288
287
return srv_config
@@ -304,7 +303,7 @@ def register_database(self, name: str, config: str=None) -> DatabaseConfig:
304
303
db_config = DatabaseConfig (name )
305
304
self .databases .value .append (db_config )
306
305
if config :
307
- parser = ConfigParser (interpolation = ExtendedInterpolation ())
306
+ parser = ConfigParser (interpolation = EnvExtendedInterpolation ())
308
307
parser .read_string (config )
309
308
db_config .load_config (parser , name )
310
309
return db_config
0 commit comments