mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-12-04 19:45:41 +08:00
fix: fix scripts
Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com>
This commit is contained in:
parent
3b74ad56d4
commit
104e69ecd4
@ -35,6 +35,8 @@ declare -A TEMPLATES=(
|
||||
["${OPENIM_ROOT}/deployments/templates/alertmanager.yml"]="${OPENIM_ROOT}/config/alertmanager.yml"
|
||||
)
|
||||
|
||||
openim::log::info "Read more configuration information: https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/environment.md"
|
||||
|
||||
for template in "${!TEMPLATES[@]}"; do
|
||||
if [[ ! -f "${template}" ]]; then
|
||||
openim::log::error_exit "template file ${template} does not exist..."
|
||||
@ -42,6 +44,16 @@ for template in "${!TEMPLATES[@]}"; do
|
||||
|
||||
IFS=';' read -ra OUTPUT_FILES <<< "${TEMPLATES[$template]}"
|
||||
for output_file in "${OUTPUT_FILES[@]}"; do
|
||||
if [[ -f "${output_file}" ]]; then
|
||||
read -p "File ${output_file} already exists. Overwrite? (Y/N): " -r
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
openim::log::info "Overwriting ${output_file}. Previous configuration will be lost."
|
||||
else
|
||||
openim::log::info "Skipping generation of ${output_file}."
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
|
||||
openim::log::info "⌚ Working with template file: ${template} to ${output_file}..."
|
||||
"${OPENIM_ROOT}/scripts/genconfig.sh" "${ENV_FILE}" "${template}" > "${output_file}" || {
|
||||
openim::log::error "Error processing template file ${template}"
|
||||
|
||||
@ -61,6 +61,7 @@ openim::tools::pre_start_name() {
|
||||
local targets=(
|
||||
ncpu
|
||||
component
|
||||
up35
|
||||
)
|
||||
echo "${targets[@]}"
|
||||
}
|
||||
|
||||
@ -5,13 +5,12 @@ import (
|
||||
"errors"
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"strconv"
|
||||
|
||||
"github.com/go-sql-driver/mysql"
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/db/mgo"
|
||||
mongoModel "github.com/openimsdk/open-im-server/v3/pkg/common/db/table/relation"
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/db/unrelation"
|
||||
mysqlModel "github.com/openimsdk/open-im-server/v3/tools/data-conversion/openim/mysql/v3"
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
"go.mongodb.org/mongo-driver/mongo/options"
|
||||
@ -19,12 +18,10 @@ import (
|
||||
gormMysql "gorm.io/driver/mysql"
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/logger"
|
||||
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/db/mgo"
|
||||
mongoModel "github.com/openimsdk/open-im-server/v3/pkg/common/db/table/relation"
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/db/unrelation"
|
||||
mysqlModel "github.com/openimsdk/open-im-server/v3/tools/data-conversion/openim/mysql/v3"
|
||||
"log"
|
||||
"os"
|
||||
"reflect"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -34,12 +31,9 @@ const (
|
||||
)
|
||||
|
||||
func main() {
|
||||
var dir string
|
||||
flag.StringVar(&dir, "c", "../../../../../", "path to config directory")
|
||||
var path string
|
||||
flag.StringVar(&path, "c", "", "path config file")
|
||||
flag.Parse()
|
||||
|
||||
path := filepath.Join(dir, "config.yaml")
|
||||
|
||||
if err := Main(path); err != nil {
|
||||
log.Fatal(err)
|
||||
return
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user