1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-04 08:28:11 +00:00

rm ccnet.conf (#7028)

This commit is contained in:
欢乐马
2024-11-11 20:05:26 +08:00
committed by GitHub
parent bf4f101a06
commit a5d4870526
6 changed files with 32 additions and 73 deletions

View File

@@ -136,32 +136,32 @@ class DBUpdater(object):
@staticmethod
def get_ccnet_mysql_info(version):
config_path = env_mgr.central_config_dir
ccnet_conf = os.path.join(config_path, 'ccnet.conf')
seafile_conf = os.path.join(config_path, 'seafile.conf')
defaults = {
'HOST': '127.0.0.1',
'PORT': '3306',
'UNIX_SOCKET': '',
}
config = Utils.read_config(ccnet_conf, defaults)
db_section = 'Database'
config = Utils.read_config(seafile_conf, defaults)
db_section = 'database'
if not config.has_section(db_section):
return None
type = config.get(db_section, 'ENGINE')
type = config.get(db_section, 'type')
if type != 'mysql':
return None
try:
host = config.get(db_section, 'HOST')
port = config.getint(db_section, 'PORT')
username = config.get(db_section, 'USER')
password = config.get(db_section, 'PASSWD')
db = config.get(db_section, 'DB')
host = config.get(db_section, 'host')
port = config.getint(db_section, 'port')
username = config.get(db_section, 'user')
password = config.get(db_section, 'password')
db = os.environ.get('SEAFILE_MYSQL_DB_CCNET_DB_NAME', '') or 'ccnet_db'
unix_socket = config.get(db_section, 'UNIX_SOCKET')
except configparser.NoOptionError as e:
Utils.error('Database config in ccnet.conf is invalid: %s' % e)
Utils.error('Database config in seafile.conf is invalid: %s' % e)
info = MySQLDBInfo(host, port, username, password, db, unix_socket)
return info