Move database.name add adiditional comments

This commit is contained in:
FusionPBX
2023-02-07 22:56:44 -07:00
committed by GitHub
parent 78b4651106
commit 1078bacd70

View File

@@ -58,11 +58,11 @@
--database switch settings
if (k == "database.1.type") then database.switch.type = v; end
if (k == "database.1.path") then database.switch.path = v; end
if (k == "database.1.name") then database.switch.name = v; end
if (k == "database.1.host") then database.switch.host = v; end
if (k == "database.1.hostaddr") then database.switch.hostaddr = v; end
if (k == "database.1.port") then database.switch.port = v; end
if (k == "database.1.sslmode") then database.switch.sslmode = v; end
if (k == "database.1.name") then database.switch.name = v; end
if (k == "database.1.username") then database.switch.username = v; end
if (k == "database.1.password") then database.switch.password = v; end
if (k == "database.1.backend.base64") then database.backend.base64 = v; end
@@ -71,6 +71,7 @@
if (k == "switch.conf.dir") then conf_dir = v; end
if (k == "switch.sounds.dir") then sounds_dir = v; end
if (k == "switch.database.dir") then database_dir = v; end
if (k == "switch.database.name") then database_name = v; end
if (k == "switch.recordings.dir") then recordings_dir = v; end
if (k == "switch.storage.dir") then storage_dir = v; end
if (k == "switch.voicemail.dir") then voicemail_dir = v; end
@@ -101,17 +102,17 @@
end
io.close(file);
--additional database setting
--set the database values
database.type = database.switch.type;
database.name = database.switch.name;
if (database.switch.path) then
if (database.type == 'sqlite') then
database.path = database.switch.path;
database_dir = database.switch.path;
database.name = database.switch.name;
end
--database system dsn
system_dsn = {}
if (database.system.type == 'pgsql') then
--create the system_dsn array
table.insert(system_dsn, [[pgsql://]]);
if (database.system.host) then
table.insert(system_dsn, [[host=]] .. database.system.host .. [[ ]]);
@@ -127,6 +128,7 @@
table.insert(system_dsn, [[user=]] .. database.system.username .. [[ ]]);
table.insert(system_dsn, [[password=]] .. database.system.password .. [[ ]]);
elseif (database.system.type == 'sqlite') then
--create the system_dsn array
table.insert(system_dsn, [[sqlite://]] .. database.system.path .. [[/]].. database.system.name ..[[ ]]);
end
database.system = table.concat(system_dsn, '');
@@ -134,6 +136,7 @@
--database switch dsn
switch_dsn = {}
if (database.switch.type == 'pgsql') then
--create the switch_dsn array
table.insert(switch_dsn, [[pgsql://]]);
if (database.switch.host) then
table.insert(switch_dsn, [[host=]] .. database.switch.host .. [[ ]]);
@@ -151,6 +154,7 @@
table.insert(switch_dsn, [[password=]] .. database.switch.password .. [[ ]]);
database.switch = table.concat(switch_dsn, '');
elseif (database.switch.type == 'sqlite') then
--create the switch_dsn array
table.insert(switch_dsn, [[sqlite://]] .. database.switch.path .. [[/]].. database.switch.name ..[[ ]]);
end
database.switch = table.concat(switch_dsn, '');