Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
7a6226b
pupu
Gwynbleidd0241 May 27, 2026
c5c6770
merge main
Gwynbleidd0241 Jul 9, 2026
6114343
draft config v2
Gwynbleidd0241 Jul 13, 2026
dbe5c0c
merge main
Gwynbleidd0241 Jul 15, 2026
4dc7572
fix
Gwynbleidd0241 Jul 22, 2026
b01ac86
some refactor
Gwynbleidd0241 Jul 23, 2026
1eb14b8
update
Gwynbleidd0241 Jul 28, 2026
ebcf7a8
update
Gwynbleidd0241 Jul 29, 2026
7f3a924
refactor
Gwynbleidd0241 Jul 29, 2026
cb6d68c
big update
Gwynbleidd0241 Jul 29, 2026
57cfb62
refactor
Gwynbleidd0241 Jul 31, 2026
3f452b9
fix lint
Gwynbleidd0241 Jul 31, 2026
2e6e58d
merge main
Gwynbleidd0241 Aug 4, 2026
22592ac
merge main
Gwynbleidd0241 Aug 4, 2026
aef2130
fix
Gwynbleidd0241 Aug 5, 2026
1e31dd1
update config package(merge, loader, config scheme)
Gwynbleidd0241 Sep 1, 2026
e9f2185
create normalize file in package config, fix merge options, refactor …
Gwynbleidd0241 Sep 2, 2026
b558fe5
refactor schema config
Gwynbleidd0241 Sep 3, 2026
cf16c5c
update config scheme
Gwynbleidd0241 Sep 16, 2026
d635602
Merge branch 'main' into 47-config-v2
Gwynbleidd0241 Oct 6, 2026
8ae7ed2
some refactor
Gwynbleidd0241 Oct 7, 2026
6d0ff2a
Merge branch 'main' into 47-config-v2
Gwynbleidd0241 Oct 7, 2026
abe2ed3
merge main
Gwynbleidd0241 Oct 7, 2026
d78b056
merge main
Gwynbleidd0241 Oct 8, 2026
99f86e8
update config.server
Gwynbleidd0241 Oct 12, 2026
cac00da
update server/mw/config/auth/cmd
Gwynbleidd0241 Oct 13, 2026
e5d6c34
update auth/config/midrate/cache
Gwynbleidd0241 Oct 14, 2026
44a708b
update cmd, api/seqapi-async, app/config-types, pkg/repository-servic…
Gwynbleidd0241 Oct 14, 2026
17c74f5
take two: update cmd, api/seqapi-async, app/config-types, pkg/reposit…
Gwynbleidd0241 Oct 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ TIME := $(shell date '+%Y-%m-%d_%H:%M:%S')

MIGRATION_DSN ?= postgresql://localhost/postgres?sslmode=disable&user=postgres&password=postgres
MIGRATION_DSN_CLICKHOUSE ?= tcp://default@localhost:9000/seq_ui_server
SOURCE_CONFIG ?= config/config.local.yaml

LOCAL_BIN := $(CURDIR)/bin

Expand Down Expand Up @@ -58,6 +59,10 @@ push-migration-image: build-migration-image
run: .check-config
go run ./cmd/seq-ui -config=config/config.local.yaml

.PHONY: config-migrate
config-migrate:
go run ./cmd/config-migrate -source=${SOURCE_CONFIG}

.PHONY: .check-config
.check-config:
@if [ ! -f config/config.local.yaml ]; then\
Expand Down
63 changes: 63 additions & 0 deletions cmd/config-migrate/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package main

import (
"errors"
"flag"
"os"
"path/filepath"
"strings"

"go.uber.org/zap"

"github.com/ozontech/seq-ui/internal/app/config/loader"
"github.com/ozontech/seq-ui/logger"
)

var (
source = flag.String("source", "", "path to the config file to migrate in place")
)

func main() {
flag.Parse()

run(*source)
}

func run(source string) {
if source == "" {
logger.Fatal("miss required parameter", zap.String("param", "-source"))
}

stat, err := os.Stat(source)
if err != nil {
logger.Fatal("stat source", zap.String("source", source), zap.Error(err))
}

sourceCfg, err := os.ReadFile(source) //nolint:gosec
if err != nil {
logger.Fatal("read source config", zap.String("source", source), zap.Error(err))
}

migratedCfg, err := loader.ToLatestVersion(sourceCfg)
if errors.Is(err, loader.ErrAlreadyLatestConfigVersion) {
logger.Info("source config is already at the latest schema version, nothing to migrate", zap.String("source", source))
return
}
if err != nil {
logger.Fatal("migrate config", zap.String("source", source), zap.Error(err))
}

backupPath := strings.TrimSuffix(source, filepath.Ext(source)) + ".bck" + filepath.Ext(source)
if _, err := os.Stat(backupPath); err == nil {
logger.Fatal("backup already exists, remove it before re-running", zap.String("backup", backupPath))
}
if err := os.WriteFile(backupPath, sourceCfg, stat.Mode()); err != nil {
logger.Fatal("write backup config", zap.String("backup", backupPath), zap.Error(err))
}

if err := os.WriteFile(source, migratedCfg, stat.Mode()); err != nil {
logger.Fatal("write migrated config", zap.Error(err))
}

logger.Info("config migrated", zap.String("source", source), zap.String("backup", backupPath))
}
Loading
Loading