add postgres support for luci
This commit is contained in:
parent
dc7d9b8dc4
commit
2930a1c61e
@ -23,11 +23,15 @@ get_config() {
|
|||||||
|
|
||||||
# mysql
|
# mysql
|
||||||
config_get mysql $1 mysql 0
|
config_get mysql $1 mysql 0
|
||||||
|
config_get mysql_type $1 mysql_type "mysql"
|
||||||
config_get mysql_host $1 mysql_host ""
|
config_get mysql_host $1 mysql_host ""
|
||||||
config_get mysql_port $1 mysql_port "3306"
|
config_get mysql_port $1 mysql_port "3306"
|
||||||
config_get mysql_username $1 mysql_username ""
|
config_get mysql_username $1 mysql_username ""
|
||||||
config_get mysql_password $1 mysql_password ""
|
config_get mysql_password $1 mysql_password ""
|
||||||
config_get mysql_database $1 mysql_database ""
|
config_get mysql_database $1 mysql_database ""
|
||||||
|
config_get mysql_table_prefix $1 mysql_table_prefix "x_"
|
||||||
|
config_get mysql_ssl_mode $1 mysql_ssl_mode ""
|
||||||
|
config_get mysql_dsn $1 mysql_dsn ""
|
||||||
|
|
||||||
config_load network
|
config_load network
|
||||||
config_get lan_addr lan ipaddr "0.0.0.0"
|
config_get lan_addr lan ipaddr "0.0.0.0"
|
||||||
@ -77,7 +81,7 @@ start_service() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# mysql
|
# mysql
|
||||||
[ "$mysql" -eq 1 ] && database=mysql || database=sqlite3
|
[ "$mysql" -eq 1 ] && database=$mysql_type || database=sqlite3
|
||||||
|
|
||||||
set_firewall
|
set_firewall
|
||||||
true > $temp_dir/alist.log
|
true > $temp_dir/alist.log
|
||||||
@ -99,9 +103,9 @@ start_service() {
|
|||||||
json_add_string "password" "$mysql_password"
|
json_add_string "password" "$mysql_password"
|
||||||
json_add_string "name" "$mysql_database"
|
json_add_string "name" "$mysql_database"
|
||||||
json_add_string "db_file" "$data_dir/data.db"
|
json_add_string "db_file" "$data_dir/data.db"
|
||||||
json_add_string "table_prefix" "x_"
|
json_add_string "table_prefix" "$mysql_table_prefix"
|
||||||
json_add_string "ssl_mode" ""
|
json_add_string "ssl_mode" "$mysql_ssl_mode"
|
||||||
json_add_string "dsn" ""
|
json_add_string "dsn" "$mysql_dsn"
|
||||||
json_close_object
|
json_close_object
|
||||||
|
|
||||||
# meilisearch
|
# meilisearch
|
||||||
|
@ -31,23 +31,30 @@ o = s:option(Value,"ssl_key", translate("SSL key"), translate("SSL key file path
|
|||||||
o.datatype = "file"
|
o.datatype = "file"
|
||||||
o:depends("ssl", "1")
|
o:depends("ssl", "1")
|
||||||
|
|
||||||
o = s:option(Flag, "mysql", translate("Enable MySQL"))
|
o = s:option(Flag, "mysql", translate("Enable Database"))
|
||||||
o.rmempty=false
|
o.rmempty=false
|
||||||
|
|
||||||
o = s:option(Value,"mysql_host", translate("MySQL Host"))
|
o = s:option(ListValue, "mysql_type", translate("Database Type"))
|
||||||
|
o.datatype = "string"
|
||||||
|
o:value("mysql", translate("MySQL"))
|
||||||
|
o:value("postgres", translate("PostgreSQL"))
|
||||||
|
o.default = "mysql"
|
||||||
|
o:depends("mysql", "1")
|
||||||
|
|
||||||
|
o = s:option(Value,"mysql_host", translate("Database Host"))
|
||||||
o.datatype = "string"
|
o.datatype = "string"
|
||||||
o:depends("mysql", "1")
|
o:depends("mysql", "1")
|
||||||
|
|
||||||
o = s:option(Value,"mysql_port", translate("MySQL Port"))
|
o = s:option(Value,"mysql_port", translate("Database Port"))
|
||||||
o.datatype = "and(port,min(1))"
|
o.datatype = "and(port,min(1))"
|
||||||
o.default = "3306"
|
o.default = "3306"
|
||||||
o:depends("mysql", "1")
|
o:depends("mysql", "1")
|
||||||
|
|
||||||
o = s:option(Value,"mysql_username", translate("MySQL Username"))
|
o = s:option(Value,"mysql_username", translate("Database Username"))
|
||||||
o.datatype = "string"
|
o.datatype = "string"
|
||||||
o:depends("mysql", "1")
|
o:depends("mysql", "1")
|
||||||
|
|
||||||
o = s:option(Value,"mysql_password", translate("MySQL Password"))
|
o = s:option(Value,"mysql_password", translate("Database Password"))
|
||||||
o.datatype = "string"
|
o.datatype = "string"
|
||||||
o.password = true
|
o.password = true
|
||||||
o:depends("mysql", "1")
|
o:depends("mysql", "1")
|
||||||
@ -56,6 +63,19 @@ o = s:option(Value,"mysql_database", translate("Database Name"))
|
|||||||
o.datatype = "string"
|
o.datatype = "string"
|
||||||
o:depends("mysql", "1")
|
o:depends("mysql", "1")
|
||||||
|
|
||||||
|
o = s:option(Value,"mysql_table_prefix", translate("Database Table Prefix"))
|
||||||
|
o.datatype = "string"
|
||||||
|
o.default = "x_"
|
||||||
|
o:depends("mysql", "1")
|
||||||
|
|
||||||
|
o = s:option(Value,"mysql_ssl_mode", translate("Database SSL Mode"))
|
||||||
|
o.datatype = "string"
|
||||||
|
o:depends("mysql", "1")
|
||||||
|
|
||||||
|
o = s:option(Value,"mysql_dsn", translate("Database DSN"))
|
||||||
|
o.datatype = "string"
|
||||||
|
o:depends("mysql", "1")
|
||||||
|
|
||||||
o = s:option(Flag, "allow_wan", translate("Allow Access From Internet"))
|
o = s:option(Flag, "allow_wan", translate("Allow Access From Internet"))
|
||||||
o.rmempty = false
|
o.rmempty = false
|
||||||
|
|
||||||
|
@ -94,20 +94,33 @@ msgstr "Web 被反向代理到二级目录时,必须填写该选项以确保 W
|
|||||||
msgid "Delayed Start (seconds)"
|
msgid "Delayed Start (seconds)"
|
||||||
msgstr "开机延时启动(秒)"
|
msgstr "开机延时启动(秒)"
|
||||||
|
|
||||||
msgid "Enable MySQL"
|
msgid "Enable Database"
|
||||||
msgstr "启用 MySQL"
|
msgstr "启用远程数据库"
|
||||||
|
|
||||||
msgid "MySQL Host"
|
msgid "Database Type"
|
||||||
|
msgstr "类型"
|
||||||
|
|
||||||
|
msgid "Database Host"
|
||||||
msgstr "主机"
|
msgstr "主机"
|
||||||
|
|
||||||
msgid "MySQL Port"
|
msgid "Database Port"
|
||||||
msgstr "端口"
|
msgstr "端口"
|
||||||
|
|
||||||
msgid "MySQL Username"
|
msgid "Database Username"
|
||||||
msgstr "用户名"
|
msgstr "用户名"
|
||||||
|
|
||||||
msgid "MySQL Password"
|
msgid "Database Password"
|
||||||
msgstr "密码"
|
msgstr "密码"
|
||||||
|
|
||||||
msgid "Database Name"
|
msgid "Database Name"
|
||||||
msgstr "数据库名"
|
msgstr "数据库名"
|
||||||
|
|
||||||
|
msgid "Database Table Prefix"
|
||||||
|
msgstr "数据库表前缀"
|
||||||
|
|
||||||
|
msgid "Database SSL Mode"
|
||||||
|
msgstr "SSL模式"
|
||||||
|
|
||||||
|
msgid "Database DSN"
|
||||||
|
msgstr "DSN"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user