mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-09-08 07:34:59 +08:00
parent
12b9356c17
commit
7c49f6c79b
7 changed files with 16 additions and 10 deletions
|
@ -4,14 +4,14 @@ import "time"
|
|||
|
||||
// common
|
||||
type DBConfUpdateByFile struct {
|
||||
Type string `json:"type" validate:"required,oneof=mysql mariadb postgresql redis mysql-cluster postgresql-cluster"`
|
||||
Type string `json:"type" validate:"required,oneof=mysql mariadb postgresql redis mysql-cluster postgresql-cluster redis-cluster"`
|
||||
Database string `json:"database" validate:"required"`
|
||||
File string `json:"file"`
|
||||
}
|
||||
type ChangeDBInfo struct {
|
||||
ID uint `json:"id"`
|
||||
From string `json:"from" validate:"required,oneof=local remote"`
|
||||
Type string `json:"type" validate:"required,oneof=mysql mariadb postgresql mysql-cluster postgresql-cluster"`
|
||||
Type string `json:"type" validate:"required,oneof=mysql mariadb postgresql mysql-cluster postgresql-cluster redis-cluster"`
|
||||
Database string `json:"database" validate:"required"`
|
||||
Value string `json:"value" validate:"required"`
|
||||
}
|
||||
|
|
|
@ -672,7 +672,7 @@ func (a *AppInstallService) GetDefaultConfigByKey(key, name string) (string, err
|
|||
if key == constant.AppMysql || key == constant.AppMariaDB || key == constant.AppMysqlCluster {
|
||||
filePath = path.Join(filePath, "my.cnf")
|
||||
}
|
||||
if key == constant.AppRedis {
|
||||
if key == constant.AppRedis || key == constant.AppRedisCluster {
|
||||
filePath = path.Join(filePath, "redis.conf")
|
||||
}
|
||||
if key == constant.AppOpenresty {
|
||||
|
|
|
@ -74,11 +74,11 @@ func (u *DBCommonService) UpdateConfByFile(req dto.DBConfUpdateByFile) error {
|
|||
}
|
||||
path := ""
|
||||
switch req.Type {
|
||||
case constant.AppMariaDB, constant.AppMysql:
|
||||
case constant.AppMariaDB, constant.AppMysql, constant.AppMysqlCluster:
|
||||
path = fmt.Sprintf("%s/%s/%s/conf/my.cnf", global.Dir.AppInstallDir, req.Type, app.Name)
|
||||
case constant.AppPostgresql:
|
||||
case constant.AppPostgresql, constant.AppPostgresqlCluster:
|
||||
path = fmt.Sprintf("%s/%s/%s/data/postgresql.conf", global.Dir.AppInstallDir, req.Type, app.Name)
|
||||
case constant.AppRedis:
|
||||
case constant.AppRedis, constant.AppRedisCluster:
|
||||
path = fmt.Sprintf("%s/%s/%s/conf/redis.conf", global.Dir.AppInstallDir, req.Type, app.Name)
|
||||
}
|
||||
file, err := os.OpenFile(path, os.O_WRONLY|os.O_TRUNC, 0640)
|
||||
|
|
|
@ -53,7 +53,7 @@ func (u *RedisService) UpdateConf(req dto.RedisConfUpdate) error {
|
|||
if err := confSet(redisInfo.Name, req.DBType, "", confs); err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err := compose.Restart(fmt.Sprintf("%s/redis/%s/docker-compose.yml", global.Dir.AppInstallDir, redisInfo.Name)); err != nil {
|
||||
if _, err := compose.Restart(fmt.Sprintf("%s/%s/%s/docker-compose.yml", global.Dir.AppInstallDir, req.DBType, redisInfo.Name)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
@ -221,6 +221,7 @@ export namespace Database {
|
|||
|
||||
// redis
|
||||
export interface RedisConfUpdate {
|
||||
dbType: string;
|
||||
database: string;
|
||||
timeout: string;
|
||||
maxclients: string;
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
<template #main>
|
||||
<div v-if="activeName === 'conf'">
|
||||
<CodemirrorPro v-model="postgresqlConf"></CodemirrorPro>
|
||||
<CodemirrorPro :heightDiff="320" v-model="postgresqlConf"></CodemirrorPro>
|
||||
<el-button type="primary" class="mt-5" @click="onSaveConf">
|
||||
{{ $t('commons.button.save') }}
|
||||
</el-button>
|
||||
|
|
|
@ -39,7 +39,11 @@
|
|||
</template>
|
||||
<template #main>
|
||||
<div v-if="activeName === 'conf'">
|
||||
<CodemirrorPro v-model="redisConf" :placeholder="$t('commons.msg.noneData')"></CodemirrorPro>
|
||||
<CodemirrorPro
|
||||
:heightDiff="340"
|
||||
v-model="redisConf"
|
||||
:placeholder="$t('commons.msg.noneData')"
|
||||
></CodemirrorPro>
|
||||
<el-button class="mt-5" @click="getDefaultConfig()">
|
||||
{{ $t('app.defaultConfig') }}
|
||||
</el-button>
|
||||
|
@ -232,6 +236,7 @@ const onChangePort = async (formEl: FormInstance | undefined) => {
|
|||
return;
|
||||
}
|
||||
let params = {
|
||||
type: dbType.value,
|
||||
key: dbType.value,
|
||||
name: form.name,
|
||||
port: form.port,
|
||||
|
@ -262,7 +267,7 @@ const onSubmitForm = async (formEl: FormInstance | undefined) => {
|
|||
};
|
||||
const submitForm = async () => {
|
||||
let param = {
|
||||
dbType: 'redis',
|
||||
dbType: dbType.value,
|
||||
database: database.value,
|
||||
timeout: form.timeout + '',
|
||||
maxclients: form.maxclients + '',
|
||||
|
|
Loading…
Add table
Reference in a new issue