модернизация настроек БД
This commit is contained in:
parent
267151f546
commit
27797f35a3
@ -1,6 +1,13 @@
|
||||
[postgresql]
|
||||
[export]
|
||||
host=localhost
|
||||
port=5432
|
||||
database=ss14
|
||||
user=ss14_user
|
||||
password=ss14_password
|
||||
|
||||
[import]
|
||||
host=localhost
|
||||
port=6432
|
||||
database=ss14
|
||||
user=ss14_user
|
||||
password=ss14_password
|
||||
@ -14,13 +14,13 @@ def read_config() -> dict[str, str]:
|
||||
parser.read("database.ini")
|
||||
|
||||
db = {}
|
||||
if parser.has_section("postgresql"):
|
||||
params = parser.items("postgresql")
|
||||
if parser.has_section("export"):
|
||||
params = parser.items("export")
|
||||
for param in params:
|
||||
db[param[0]] = param[1]
|
||||
else:
|
||||
raise ParseConfig(
|
||||
'Section {0} not found in the {1} file'.format("postgresql",
|
||||
'Section {0} not found in the {1} file'.format("export",
|
||||
"database.ini"))
|
||||
|
||||
return db
|
||||
|
||||
@ -18,13 +18,13 @@ def read_config() -> dict[str, str]:
|
||||
parser.read("database.ini")
|
||||
|
||||
db = {}
|
||||
if parser.has_section("postgresql"):
|
||||
params = parser.items("postgresql")
|
||||
if parser.has_section("import"):
|
||||
params = parser.items("import")
|
||||
for param in params:
|
||||
db[param[0]] = param[1]
|
||||
else:
|
||||
raise ParseConfig(
|
||||
'Section {0} not found in the {1} file'.format("postgresql",
|
||||
'Section {0} not found in the {1} file'.format("import",
|
||||
"database.ini"))
|
||||
|
||||
return db
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user