1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-04-28 19:25:03 +00:00
seahub/scripts/check-db-type.py

24 lines
540 B
Python
Raw Normal View History

2021-12-03 08:53:27 +00:00
import sys
from configparser import ConfigParser
if len(sys.argv) != 2:
print('check-db-type.py <seafile-config-file>', file=sys.stderr)
seafile_conf_file = sys.argv[1]
parser = ConfigParser()
parser.read(seafile_conf_file)
if not parser.has_option('database', 'type'):
print('sqlite')
else:
db_type = parser.get('database', 'type')
if db_type == 'sqlite':
print('sqlite')
elif db_type == 'mysql':
print('mysql')
elif db_type == 'pgsql':
print('pgsql')
else:
print('unknown')