perf: databases protocol required (#9354)

Co-authored-by: feng <1304903146@qq.com>
pull/9355/head
fit2bot 2 years ago committed by GitHub
parent 7ba7d178e5
commit 47cd79ea5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -58,36 +58,43 @@ class Protocol(ChoicesMixin, models.TextChoices):
return { return {
cls.mysql: { cls.mysql: {
'port': 3306, 'port': 3306,
'setting': {},
'required': True,
'secret_types': ['password'], 'secret_types': ['password'],
'setting': {
}
}, },
cls.mariadb: { cls.mariadb: {
'port': 3306, 'port': 3306,
'required': True,
'secret_types': ['password'], 'secret_types': ['password'],
}, },
cls.postgresql: { cls.postgresql: {
'port': 5432, 'port': 5432,
'required': True,
'secret_types': ['password'], 'secret_types': ['password'],
}, },
cls.oracle: { cls.oracle: {
'port': 1521, 'port': 1521,
'required': True,
'secret_types': ['password'], 'secret_types': ['password'],
}, },
cls.sqlserver: { cls.sqlserver: {
'port': 1433, 'port': 1433,
'required': True,
'secret_types': ['password'], 'secret_types': ['password'],
}, },
cls.clickhouse: { cls.clickhouse: {
'port': 9000, 'port': 9000,
'required': True,
'secret_types': ['password'], 'secret_types': ['password'],
}, },
cls.mongodb: { cls.mongodb: {
'port': 27017, 'port': 27017,
'required': True,
'secret_types': ['password'], 'secret_types': ['password'],
}, },
cls.redis: { cls.redis: {
'port': 6379, 'port': 6379,
'required': True,
'secret_types': ['password'], 'secret_types': ['password'],
}, },
} }
@ -97,6 +104,7 @@ class Protocol(ChoicesMixin, models.TextChoices):
return { return {
cls.k8s: { cls.k8s: {
'port': 443, 'port': 443,
'required': True,
'secret_types': ['token'], 'secret_types': ['token'],
}, },
cls.http: { cls.http: {

@ -302,8 +302,8 @@ class AllTypes(ChoicesMixin):
protocols_data = [p for p in protocols_data if p['name'] in _protocols] protocols_data = [p for p in protocols_data if p['name'] in _protocols]
for p in protocols_data: for p in protocols_data:
setting = _protocols_setting.get(p['name'], {}) setting = _protocols_setting.get(p['name'], {})
p['required'] = setting.pop('required', False) p['required'] = p.pop('required', False)
p['default'] = setting.pop('default', False) p['default'] = p.pop('default', False)
p['setting'] = {**setting, **p.get('setting', {})} p['setting'] = {**setting, **p.get('setting', {})}
platform_data = { platform_data = {

Loading…
Cancel
Save