create-entity-server 0.7.11 → 0.9.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/template/.env.example +6 -0
- package/template/configs/mimes.json +64 -0
- package/template/configs/server.json +1 -0
- package/template/entities/System/Auth/license.json +7 -3
- package/template/entities/System/Auth/rbac_roles.json +6 -1
- package/template/entities/System/Storage/file_meta.json +9 -0
- package/template/scripts/api-key.ps1 +123 -123
- package/template/scripts/cleanup-history.ps1 +69 -69
- package/template/scripts/cli.ps1 +24 -24
- package/template/scripts/entity.ps1 +70 -70
- package/template/scripts/generate-env-keys.ps1 +125 -125
- package/template/scripts/normalize-entities.ps1 +87 -87
- package/template/scripts/rbac-role.ps1 +124 -124
- package/template/scripts/reset-all.ps1 +83 -83
- package/template/scripts/run.ps1 +248 -248
- package/template/scripts/run.sh +69 -19
- package/template/scripts/service-install.sh +13 -104
- package/template/scripts/service-remove.sh +2 -2
- package/template/scripts/sync.ps1 +145 -145
- package/template/scripts/update-server.ps1 +289 -289
package/package.json
CHANGED
package/template/.env.example
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
# 서버 포트 (configs/server.json의 port를 오버라이드)
|
|
2
2
|
# SERVER_PORT=47200
|
|
3
3
|
|
|
4
|
+
# 서버 네임스페이스 (configs/server.json의 namespace보다 우선)
|
|
5
|
+
# SERVER_NAMESPACE=entity-prod
|
|
6
|
+
|
|
7
|
+
# 기본 이메일 도메인 (configs/server.json의 default_email_domain보다 우선)
|
|
8
|
+
# DEFAULT_EMAIL_DOMAIN=example.com
|
|
9
|
+
|
|
4
10
|
# Entity Server 환경변수 설정 예시
|
|
5
11
|
# 실제 사용시 이 파일을 .env로 복사하고 값을 변경하세요: cp .env.example .env
|
|
6
12
|
# ./scripts/generate-env-keys.sh 를 사용하여 랜덤 시크릿을 생성할 수 있습니다.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"jpg": ["image/jpeg", "image/pjpeg"],
|
|
3
|
+
"jpeg": ["image/jpeg", "image/pjpeg"],
|
|
4
|
+
"png": "image/png",
|
|
5
|
+
"gif": "image/gif",
|
|
6
|
+
"webp": "image/webp",
|
|
7
|
+
"bmp": ["image/bmp", "image/x-bmp", "image/x-ms-bmp"],
|
|
8
|
+
"tif": "image/tiff",
|
|
9
|
+
"tiff": "image/tiff",
|
|
10
|
+
"svg": "image/svg+xml",
|
|
11
|
+
"pdf": [
|
|
12
|
+
"application/pdf",
|
|
13
|
+
"application/force-download",
|
|
14
|
+
"application/x-download"
|
|
15
|
+
],
|
|
16
|
+
"csv": [
|
|
17
|
+
"text/csv",
|
|
18
|
+
"application/csv",
|
|
19
|
+
"application/vnd.ms-excel",
|
|
20
|
+
"text/plain"
|
|
21
|
+
],
|
|
22
|
+
"xls": [
|
|
23
|
+
"application/vnd.ms-excel",
|
|
24
|
+
"application/msexcel",
|
|
25
|
+
"application/x-msexcel",
|
|
26
|
+
"application/x-ms-excel",
|
|
27
|
+
"application/x-excel",
|
|
28
|
+
"application/vnd.ms-office"
|
|
29
|
+
],
|
|
30
|
+
"xlsx": [
|
|
31
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
32
|
+
"application/vnd.ms-excel",
|
|
33
|
+
"application/zip"
|
|
34
|
+
],
|
|
35
|
+
"xlsm": [
|
|
36
|
+
"application/vnd.ms-excel.sheet.macroenabled.12",
|
|
37
|
+
"application/vnd.ms-excel",
|
|
38
|
+
"application/zip"
|
|
39
|
+
],
|
|
40
|
+
"xlsb": [
|
|
41
|
+
"application/vnd.ms-excel.sheet.binary.macroenabled.12",
|
|
42
|
+
"application/vnd.ms-excel",
|
|
43
|
+
"application/zip"
|
|
44
|
+
],
|
|
45
|
+
"doc": ["application/msword", "application/vnd.ms-office"],
|
|
46
|
+
"docx": [
|
|
47
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
48
|
+
"application/zip"
|
|
49
|
+
],
|
|
50
|
+
"ppt": [
|
|
51
|
+
"application/vnd.ms-powerpoint",
|
|
52
|
+
"application/powerpoint",
|
|
53
|
+
"application/vnd.ms-office"
|
|
54
|
+
],
|
|
55
|
+
"pptx": [
|
|
56
|
+
"application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
57
|
+
"application/zip"
|
|
58
|
+
],
|
|
59
|
+
"zip": [
|
|
60
|
+
"application/zip",
|
|
61
|
+
"application/x-zip",
|
|
62
|
+
"application/x-zip-compressed"
|
|
63
|
+
]
|
|
64
|
+
}
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
},
|
|
22
22
|
"expire_date": {
|
|
23
23
|
"index": true,
|
|
24
|
-
"comment": "만료일"
|
|
24
|
+
"comment": "만료일",
|
|
25
|
+
"nullable": true
|
|
25
26
|
},
|
|
26
27
|
"name": {
|
|
27
28
|
"index": true,
|
|
@@ -44,8 +45,11 @@
|
|
|
44
45
|
"index": true,
|
|
45
46
|
"comment": "시군구"
|
|
46
47
|
},
|
|
47
|
-
"
|
|
48
|
-
"
|
|
48
|
+
"max_account_cnt": {
|
|
49
|
+
"index": true,
|
|
50
|
+
"type": "uint",
|
|
51
|
+
"default": 0,
|
|
52
|
+
"nullable": false
|
|
49
53
|
}
|
|
50
54
|
},
|
|
51
55
|
"reset_defaults": [
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rbac_roles",
|
|
3
3
|
"description": "역할 기반 접근 제어 역할 정의.",
|
|
4
|
+
"index_table_only": true,
|
|
4
5
|
"license_scope": false,
|
|
5
6
|
"hard_delete": true,
|
|
6
7
|
"fields": {
|
|
@@ -10,8 +11,12 @@
|
|
|
10
11
|
"required": true,
|
|
11
12
|
"unique": true
|
|
12
13
|
},
|
|
14
|
+
"description": {
|
|
15
|
+
"comment": "역할 설명"
|
|
16
|
+
},
|
|
13
17
|
"permissions": {
|
|
14
|
-
"type": "
|
|
18
|
+
"type": "json",
|
|
19
|
+
"comment": "권한 목록"
|
|
15
20
|
}
|
|
16
21
|
},
|
|
17
22
|
"reset_defaults": [
|
|
@@ -11,6 +11,12 @@
|
|
|
11
11
|
"type": ["none", "pending", "synced", "failed", "skipped"],
|
|
12
12
|
"default": "none"
|
|
13
13
|
},
|
|
14
|
+
"is_public": {
|
|
15
|
+
"index": true,
|
|
16
|
+
"comment": "공개 파일 여부 (인증 없이 GET 접근 가능)",
|
|
17
|
+
"type": "boolean",
|
|
18
|
+
"default": false
|
|
19
|
+
},
|
|
14
20
|
"size": {
|
|
15
21
|
"index": true,
|
|
16
22
|
"comment": "파일 크기 (bytes)",
|
|
@@ -46,9 +52,12 @@
|
|
|
46
52
|
"comment": "파일이 첨부된 필드 이름 (file/file[] 타입 필드)"
|
|
47
53
|
},
|
|
48
54
|
"mime_type": {
|
|
55
|
+
"index": true,
|
|
49
56
|
"comment": "파일 MIME 타입 (image/jpeg, application/pdf 등)"
|
|
50
57
|
},
|
|
51
58
|
"original_name": {
|
|
59
|
+
"search": true,
|
|
60
|
+
"encrypt": true,
|
|
52
61
|
"comment": "업로드 시 원본 파일명 (보안 대상 — 암호화 저장)"
|
|
53
62
|
},
|
|
54
63
|
"storage_key": {
|
|
@@ -1,123 +1,123 @@
|
|
|
1
|
-
# API Key Management Script (CLI mode) - Windows PowerShell
|
|
2
|
-
# Can be used even when the server is stopped.
|
|
3
|
-
param(
|
|
4
|
-
[Parameter(Position=0)]
|
|
5
|
-
[string]$SubCommand = ""
|
|
6
|
-
)
|
|
7
|
-
|
|
8
|
-
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
|
9
|
-
$ProjectRoot = Split-Path -Parent $ScriptDir
|
|
10
|
-
$BinPath = Join-Path $ProjectRoot "bin\entity-cli.exe"
|
|
11
|
-
|
|
12
|
-
Set-Location $ProjectRoot
|
|
13
|
-
|
|
14
|
-
# Load language from .env
|
|
15
|
-
$Language = "ko"
|
|
16
|
-
$EnvFile = Join-Path $ProjectRoot ".env"
|
|
17
|
-
if (Test-Path $EnvFile) {
|
|
18
|
-
$LangLine = Get-Content $EnvFile | Where-Object { $_ -match '^LANGUAGE=' } | Select-Object -First 1
|
|
19
|
-
if ($LangLine) { $Language = $LangLine -replace '^LANGUAGE=', '' }
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function Show-Help {
|
|
23
|
-
if ($Language -eq "en") {
|
|
24
|
-
Write-Host "API Key Management (CLI mode)"
|
|
25
|
-
Write-Host "============================="
|
|
26
|
-
Write-Host ""
|
|
27
|
-
Write-Host "Manage api_keys entity directly via CLI binary."
|
|
28
|
-
Write-Host "Server does NOT need to be running."
|
|
29
|
-
Write-Host ""
|
|
30
|
-
Write-Host "Usage: .\api-key.ps1 <subcommand> [options]"
|
|
31
|
-
Write-Host ""
|
|
32
|
-
Write-Host "Subcommands:"
|
|
33
|
-
Write-Host " list List API keys"
|
|
34
|
-
Write-Host " add Create a new API key (key/secret auto-generated)"
|
|
35
|
-
Write-Host " delete Delete an API key by seq"
|
|
36
|
-
Write-Host " help Show this help"
|
|
37
|
-
Write-Host ""
|
|
38
|
-
Write-Host "list options:"
|
|
39
|
-
Write-Host " --limit=<n> Max rows to show (default: 20)"
|
|
40
|
-
Write-Host ""
|
|
41
|
-
Write-Host "add options:"
|
|
42
|
-
Write-Host " --role=<name> Role name (default: admin)"
|
|
43
|
-
Write-Host " --entities=<json> Allowed entities JSON (default: [`"*`"])"
|
|
44
|
-
Write-Host " --description=<t> Description"
|
|
45
|
-
Write-Host " --user-seq=<n> Associated user seq"
|
|
46
|
-
Write-Host " --apply Execute (default is dry-run)"
|
|
47
|
-
Write-Host ""
|
|
48
|
-
Write-Host "delete options:"
|
|
49
|
-
Write-Host " --seq=<n> API key seq to delete (required)"
|
|
50
|
-
Write-Host " --apply Execute (default is dry-run)"
|
|
51
|
-
Write-Host ""
|
|
52
|
-
Write-Host "Examples:"
|
|
53
|
-
Write-Host " .\api-key.ps1 list"
|
|
54
|
-
Write-Host " .\api-key.ps1 list --limit=50"
|
|
55
|
-
Write-Host " .\api-key.ps1 add --role=admin --apply"
|
|
56
|
-
Write-Host " .\api-key.ps1 delete --seq=3 --apply"
|
|
57
|
-
} else {
|
|
58
|
-
Write-Host "API 키 관리 (CLI 모드)"
|
|
59
|
-
Write-Host "===================="
|
|
60
|
-
Write-Host ""
|
|
61
|
-
Write-Host "CLI 바이너리로 api_keys 엔티티를 직접 조작합니다."
|
|
62
|
-
Write-Host "서버가 실행 중이지 않아도 사용 가능합니다."
|
|
63
|
-
Write-Host ""
|
|
64
|
-
Write-Host "사용법: .\api-key.ps1 <하위명령> [옵션]"
|
|
65
|
-
Write-Host ""
|
|
66
|
-
Write-Host "하위 명령:"
|
|
67
|
-
Write-Host " list API 키 목록 조회"
|
|
68
|
-
Write-Host " add 새 API 키 생성 (키/시크릿 자동 생성)"
|
|
69
|
-
Write-Host " delete API 키 삭제 (seq 지정)"
|
|
70
|
-
Write-Host " help 도움말 출력"
|
|
71
|
-
Write-Host ""
|
|
72
|
-
Write-Host "list 옵션:"
|
|
73
|
-
Write-Host " --limit=<n> 최대 출력 행 수 (기본: 20)"
|
|
74
|
-
Write-Host ""
|
|
75
|
-
Write-Host "add 옵션:"
|
|
76
|
-
Write-Host " --role=<이름> 역할명 (기본: admin)"
|
|
77
|
-
Write-Host " --entities=<json> 허용 엔티티 JSON (기본: [`"*`"])"
|
|
78
|
-
Write-Host " --description=<t> 설명"
|
|
79
|
-
Write-Host " --user-seq=<n> 연결 사용자 seq"
|
|
80
|
-
Write-Host " --apply 실제 실행 (기본: dry-run)"
|
|
81
|
-
Write-Host ""
|
|
82
|
-
Write-Host "delete 옵션:"
|
|
83
|
-
Write-Host " --seq=<n> 삭제할 API 키 seq (필수)"
|
|
84
|
-
Write-Host " --apply 실제 실행 (기본: dry-run)"
|
|
85
|
-
Write-Host ""
|
|
86
|
-
Write-Host "예제:"
|
|
87
|
-
Write-Host " .\api-key.ps1 list"
|
|
88
|
-
Write-Host " .\api-key.ps1 list --limit=50"
|
|
89
|
-
Write-Host " .\api-key.ps1 add --role=admin --apply"
|
|
90
|
-
Write-Host " .\api-key.ps1 delete --seq=3 --apply"
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
if (-not $SubCommand) {
|
|
95
|
-
Show-Help
|
|
96
|
-
exit 0
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
if (-not (Test-Path $BinPath)) {
|
|
100
|
-
if ($Language -eq "en") { Write-Host "X bin/entity-cli.exe not found. Run: .\scripts\build.ps1" }
|
|
101
|
-
else { Write-Host "X bin/entity-cli.exe 파일이 없습니다. 먼저 .\scripts\build.ps1 를 실행하세요." }
|
|
102
|
-
exit 1
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
# Collect remaining args (all args after SubCommand)
|
|
106
|
-
$remainingArgs = $args
|
|
107
|
-
|
|
108
|
-
switch ($SubCommand) {
|
|
109
|
-
{ $_ -in @("list", "show", "add", "delete") } {
|
|
110
|
-
$env:ENTITY_CLI_NAME = "api-key"
|
|
111
|
-
& $BinPath api-key $SubCommand @remainingArgs
|
|
112
|
-
}
|
|
113
|
-
{ $_ -in @("help", "-h", "--help") } {
|
|
114
|
-
Show-Help
|
|
115
|
-
}
|
|
116
|
-
default {
|
|
117
|
-
if ($Language -eq "en") { Write-Host "X Unknown subcommand: $SubCommand" }
|
|
118
|
-
else { Write-Host "X 알 수 없는 하위 명령: $SubCommand" }
|
|
119
|
-
Write-Host ""
|
|
120
|
-
Show-Help
|
|
121
|
-
exit 1
|
|
122
|
-
}
|
|
123
|
-
}
|
|
1
|
+
# API Key Management Script (CLI mode) - Windows PowerShell
|
|
2
|
+
# Can be used even when the server is stopped.
|
|
3
|
+
param(
|
|
4
|
+
[Parameter(Position=0)]
|
|
5
|
+
[string]$SubCommand = ""
|
|
6
|
+
)
|
|
7
|
+
|
|
8
|
+
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
|
9
|
+
$ProjectRoot = Split-Path -Parent $ScriptDir
|
|
10
|
+
$BinPath = Join-Path $ProjectRoot "bin\entity-cli.exe"
|
|
11
|
+
|
|
12
|
+
Set-Location $ProjectRoot
|
|
13
|
+
|
|
14
|
+
# Load language from .env
|
|
15
|
+
$Language = "ko"
|
|
16
|
+
$EnvFile = Join-Path $ProjectRoot ".env"
|
|
17
|
+
if (Test-Path $EnvFile) {
|
|
18
|
+
$LangLine = Get-Content $EnvFile | Where-Object { $_ -match '^LANGUAGE=' } | Select-Object -First 1
|
|
19
|
+
if ($LangLine) { $Language = $LangLine -replace '^LANGUAGE=', '' }
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function Show-Help {
|
|
23
|
+
if ($Language -eq "en") {
|
|
24
|
+
Write-Host "API Key Management (CLI mode)"
|
|
25
|
+
Write-Host "============================="
|
|
26
|
+
Write-Host ""
|
|
27
|
+
Write-Host "Manage api_keys entity directly via CLI binary."
|
|
28
|
+
Write-Host "Server does NOT need to be running."
|
|
29
|
+
Write-Host ""
|
|
30
|
+
Write-Host "Usage: .\api-key.ps1 <subcommand> [options]"
|
|
31
|
+
Write-Host ""
|
|
32
|
+
Write-Host "Subcommands:"
|
|
33
|
+
Write-Host " list List API keys"
|
|
34
|
+
Write-Host " add Create a new API key (key/secret auto-generated)"
|
|
35
|
+
Write-Host " delete Delete an API key by seq"
|
|
36
|
+
Write-Host " help Show this help"
|
|
37
|
+
Write-Host ""
|
|
38
|
+
Write-Host "list options:"
|
|
39
|
+
Write-Host " --limit=<n> Max rows to show (default: 20)"
|
|
40
|
+
Write-Host ""
|
|
41
|
+
Write-Host "add options:"
|
|
42
|
+
Write-Host " --role=<name> Role name (default: admin)"
|
|
43
|
+
Write-Host " --entities=<json> Allowed entities JSON (default: [`"*`"])"
|
|
44
|
+
Write-Host " --description=<t> Description"
|
|
45
|
+
Write-Host " --user-seq=<n> Associated user seq"
|
|
46
|
+
Write-Host " --apply Execute (default is dry-run)"
|
|
47
|
+
Write-Host ""
|
|
48
|
+
Write-Host "delete options:"
|
|
49
|
+
Write-Host " --seq=<n> API key seq to delete (required)"
|
|
50
|
+
Write-Host " --apply Execute (default is dry-run)"
|
|
51
|
+
Write-Host ""
|
|
52
|
+
Write-Host "Examples:"
|
|
53
|
+
Write-Host " .\api-key.ps1 list"
|
|
54
|
+
Write-Host " .\api-key.ps1 list --limit=50"
|
|
55
|
+
Write-Host " .\api-key.ps1 add --role=admin --apply"
|
|
56
|
+
Write-Host " .\api-key.ps1 delete --seq=3 --apply"
|
|
57
|
+
} else {
|
|
58
|
+
Write-Host "API 키 관리 (CLI 모드)"
|
|
59
|
+
Write-Host "===================="
|
|
60
|
+
Write-Host ""
|
|
61
|
+
Write-Host "CLI 바이너리로 api_keys 엔티티를 직접 조작합니다."
|
|
62
|
+
Write-Host "서버가 실행 중이지 않아도 사용 가능합니다."
|
|
63
|
+
Write-Host ""
|
|
64
|
+
Write-Host "사용법: .\api-key.ps1 <하위명령> [옵션]"
|
|
65
|
+
Write-Host ""
|
|
66
|
+
Write-Host "하위 명령:"
|
|
67
|
+
Write-Host " list API 키 목록 조회"
|
|
68
|
+
Write-Host " add 새 API 키 생성 (키/시크릿 자동 생성)"
|
|
69
|
+
Write-Host " delete API 키 삭제 (seq 지정)"
|
|
70
|
+
Write-Host " help 도움말 출력"
|
|
71
|
+
Write-Host ""
|
|
72
|
+
Write-Host "list 옵션:"
|
|
73
|
+
Write-Host " --limit=<n> 최대 출력 행 수 (기본: 20)"
|
|
74
|
+
Write-Host ""
|
|
75
|
+
Write-Host "add 옵션:"
|
|
76
|
+
Write-Host " --role=<이름> 역할명 (기본: admin)"
|
|
77
|
+
Write-Host " --entities=<json> 허용 엔티티 JSON (기본: [`"*`"])"
|
|
78
|
+
Write-Host " --description=<t> 설명"
|
|
79
|
+
Write-Host " --user-seq=<n> 연결 사용자 seq"
|
|
80
|
+
Write-Host " --apply 실제 실행 (기본: dry-run)"
|
|
81
|
+
Write-Host ""
|
|
82
|
+
Write-Host "delete 옵션:"
|
|
83
|
+
Write-Host " --seq=<n> 삭제할 API 키 seq (필수)"
|
|
84
|
+
Write-Host " --apply 실제 실행 (기본: dry-run)"
|
|
85
|
+
Write-Host ""
|
|
86
|
+
Write-Host "예제:"
|
|
87
|
+
Write-Host " .\api-key.ps1 list"
|
|
88
|
+
Write-Host " .\api-key.ps1 list --limit=50"
|
|
89
|
+
Write-Host " .\api-key.ps1 add --role=admin --apply"
|
|
90
|
+
Write-Host " .\api-key.ps1 delete --seq=3 --apply"
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (-not $SubCommand) {
|
|
95
|
+
Show-Help
|
|
96
|
+
exit 0
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (-not (Test-Path $BinPath)) {
|
|
100
|
+
if ($Language -eq "en") { Write-Host "X bin/entity-cli.exe not found. Run: .\scripts\build.ps1" }
|
|
101
|
+
else { Write-Host "X bin/entity-cli.exe 파일이 없습니다. 먼저 .\scripts\build.ps1 를 실행하세요." }
|
|
102
|
+
exit 1
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
# Collect remaining args (all args after SubCommand)
|
|
106
|
+
$remainingArgs = $args
|
|
107
|
+
|
|
108
|
+
switch ($SubCommand) {
|
|
109
|
+
{ $_ -in @("list", "show", "add", "delete") } {
|
|
110
|
+
$env:ENTITY_CLI_NAME = "api-key"
|
|
111
|
+
& $BinPath api-key $SubCommand @remainingArgs
|
|
112
|
+
}
|
|
113
|
+
{ $_ -in @("help", "-h", "--help") } {
|
|
114
|
+
Show-Help
|
|
115
|
+
}
|
|
116
|
+
default {
|
|
117
|
+
if ($Language -eq "en") { Write-Host "X Unknown subcommand: $SubCommand" }
|
|
118
|
+
else { Write-Host "X 알 수 없는 하위 명령: $SubCommand" }
|
|
119
|
+
Write-Host ""
|
|
120
|
+
Show-Help
|
|
121
|
+
exit 1
|
|
122
|
+
}
|
|
123
|
+
}
|
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
# cleanup-history.ps1 — history_ttl 기준 이력 정리
|
|
2
|
-
#
|
|
3
|
-
# 사용법:
|
|
4
|
-
# .\scripts\cleanup-history.ps1 # 도움말
|
|
5
|
-
# .\scripts\cleanup-history.ps1 --apply # 전체 이력 정리 실행
|
|
6
|
-
# .\scripts\cleanup-history.ps1 --entity=account # dry-run (특정 엔티티)
|
|
7
|
-
# .\scripts\cleanup-history.ps1 --entity=account --apply
|
|
8
|
-
|
|
9
|
-
param(
|
|
10
|
-
[string]$Entity = "",
|
|
11
|
-
[switch]$Apply
|
|
12
|
-
)
|
|
13
|
-
|
|
14
|
-
$ErrorActionPreference = "Stop"
|
|
15
|
-
|
|
16
|
-
$ProjectRoot = Split-Path -Parent $PSScriptRoot
|
|
17
|
-
Set-Location $ProjectRoot
|
|
18
|
-
|
|
19
|
-
# LANGUAGE 로드
|
|
20
|
-
$Lang = $env:LANGUAGE
|
|
21
|
-
if (-not $Lang) {
|
|
22
|
-
$EnvFile = Join-Path $ProjectRoot ".env"
|
|
23
|
-
if (Test-Path $EnvFile) {
|
|
24
|
-
$line = Get-Content $EnvFile | Where-Object { $_ -match '^LANGUAGE=' } | Select-Object -Last 1
|
|
25
|
-
if ($line) { $Lang = $line -replace '^LANGUAGE=', '' }
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
if (-not $Lang) { $Lang = "ko" }
|
|
29
|
-
|
|
30
|
-
function Show-Help {
|
|
31
|
-
if ($Lang -eq "en") {
|
|
32
|
-
Write-Host "History TTL Cleanup"
|
|
33
|
-
Write-Host "==================="
|
|
34
|
-
Write-Host ""
|
|
35
|
-
Write-Host "Usage: .\scripts\cleanup-history.ps1 [-Entity <name>] [-Apply]"
|
|
36
|
-
Write-Host ""
|
|
37
|
-
Write-Host "Options:"
|
|
38
|
-
Write-Host " -Entity <name> Cleanup only one entity history"
|
|
39
|
-
Write-Host " -Apply Execute delete (default: dry-run)"
|
|
40
|
-
} else {
|
|
41
|
-
Write-Host "히스토리 TTL 정리"
|
|
42
|
-
Write-Host "================"
|
|
43
|
-
Write-Host ""
|
|
44
|
-
Write-Host "사용법: .\scripts\cleanup-history.ps1 [-Entity <이름>] [-Apply]"
|
|
45
|
-
Write-Host ""
|
|
46
|
-
Write-Host "옵션:"
|
|
47
|
-
Write-Host " -Entity <이름> 특정 엔티티 히스토리만 정리"
|
|
48
|
-
Write-Host " -Apply 실제 삭제 실행 (기본: dry-run)"
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
# 인자 없으면 도움말
|
|
53
|
-
if (-not $Apply -and -not $Entity) {
|
|
54
|
-
Show-Help
|
|
55
|
-
exit 0
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
$CliBin = Join-Path $ProjectRoot "entity-cli.exe"
|
|
59
|
-
if (-not (Test-Path $CliBin)) {
|
|
60
|
-
if ($Lang -eq "en") { Write-Error "❌ entity-cli.exe not found" }
|
|
61
|
-
else { Write-Error "❌ entity-cli.exe 파일이 없습니다" }
|
|
62
|
-
exit 1
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
$Args = @("cleanup-history")
|
|
66
|
-
if ($Entity) { $Args += "--entity=$Entity" }
|
|
67
|
-
if ($Apply) { $Args += "--apply" }
|
|
68
|
-
|
|
69
|
-
& $CliBin @Args
|
|
1
|
+
# cleanup-history.ps1 — history_ttl 기준 이력 정리
|
|
2
|
+
#
|
|
3
|
+
# 사용법:
|
|
4
|
+
# .\scripts\cleanup-history.ps1 # 도움말
|
|
5
|
+
# .\scripts\cleanup-history.ps1 --apply # 전체 이력 정리 실행
|
|
6
|
+
# .\scripts\cleanup-history.ps1 --entity=account # dry-run (특정 엔티티)
|
|
7
|
+
# .\scripts\cleanup-history.ps1 --entity=account --apply
|
|
8
|
+
|
|
9
|
+
param(
|
|
10
|
+
[string]$Entity = "",
|
|
11
|
+
[switch]$Apply
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
$ErrorActionPreference = "Stop"
|
|
15
|
+
|
|
16
|
+
$ProjectRoot = Split-Path -Parent $PSScriptRoot
|
|
17
|
+
Set-Location $ProjectRoot
|
|
18
|
+
|
|
19
|
+
# LANGUAGE 로드
|
|
20
|
+
$Lang = $env:LANGUAGE
|
|
21
|
+
if (-not $Lang) {
|
|
22
|
+
$EnvFile = Join-Path $ProjectRoot ".env"
|
|
23
|
+
if (Test-Path $EnvFile) {
|
|
24
|
+
$line = Get-Content $EnvFile | Where-Object { $_ -match '^LANGUAGE=' } | Select-Object -Last 1
|
|
25
|
+
if ($line) { $Lang = $line -replace '^LANGUAGE=', '' }
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
if (-not $Lang) { $Lang = "ko" }
|
|
29
|
+
|
|
30
|
+
function Show-Help {
|
|
31
|
+
if ($Lang -eq "en") {
|
|
32
|
+
Write-Host "History TTL Cleanup"
|
|
33
|
+
Write-Host "==================="
|
|
34
|
+
Write-Host ""
|
|
35
|
+
Write-Host "Usage: .\scripts\cleanup-history.ps1 [-Entity <name>] [-Apply]"
|
|
36
|
+
Write-Host ""
|
|
37
|
+
Write-Host "Options:"
|
|
38
|
+
Write-Host " -Entity <name> Cleanup only one entity history"
|
|
39
|
+
Write-Host " -Apply Execute delete (default: dry-run)"
|
|
40
|
+
} else {
|
|
41
|
+
Write-Host "히스토리 TTL 정리"
|
|
42
|
+
Write-Host "================"
|
|
43
|
+
Write-Host ""
|
|
44
|
+
Write-Host "사용법: .\scripts\cleanup-history.ps1 [-Entity <이름>] [-Apply]"
|
|
45
|
+
Write-Host ""
|
|
46
|
+
Write-Host "옵션:"
|
|
47
|
+
Write-Host " -Entity <이름> 특정 엔티티 히스토리만 정리"
|
|
48
|
+
Write-Host " -Apply 실제 삭제 실행 (기본: dry-run)"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
# 인자 없으면 도움말
|
|
53
|
+
if (-not $Apply -and -not $Entity) {
|
|
54
|
+
Show-Help
|
|
55
|
+
exit 0
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
$CliBin = Join-Path $ProjectRoot "entity-cli.exe"
|
|
59
|
+
if (-not (Test-Path $CliBin)) {
|
|
60
|
+
if ($Lang -eq "en") { Write-Error "❌ entity-cli.exe not found" }
|
|
61
|
+
else { Write-Error "❌ entity-cli.exe 파일이 없습니다" }
|
|
62
|
+
exit 1
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
$Args = @("cleanup-history")
|
|
66
|
+
if ($Entity) { $Args += "--entity=$Entity" }
|
|
67
|
+
if ($Apply) { $Args += "--apply" }
|
|
68
|
+
|
|
69
|
+
& $CliBin @Args
|
package/template/scripts/cli.ps1
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
# Entity CLI wrapper script (Windows PowerShell)
|
|
2
|
-
|
|
3
|
-
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
|
4
|
-
$ProjectRoot = Split-Path -Parent $ScriptDir
|
|
5
|
-
$BinPath = Join-Path $ProjectRoot "bin\entity-cli.exe"
|
|
6
|
-
|
|
7
|
-
# Load language from .env
|
|
8
|
-
$Language = "ko"
|
|
9
|
-
$EnvFile = Join-Path $ProjectRoot ".env"
|
|
10
|
-
if (Test-Path $EnvFile) {
|
|
11
|
-
$LangLine = Get-Content $EnvFile | Where-Object { $_ -match '^LANGUAGE=' } | Select-Object -First 1
|
|
12
|
-
if ($LangLine) { $Language = $LangLine -replace '^LANGUAGE=', '' }
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
# Require prebuilt CLI binary
|
|
16
|
-
if (-not (Test-Path $BinPath)) {
|
|
17
|
-
if ($Language -eq "en") { Write-Host "X bin/entity-cli.exe not found" }
|
|
18
|
-
else { Write-Host "X bin/entity-cli.exe 파일이 없습니다" }
|
|
19
|
-
exit 1
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
Set-Location $ProjectRoot
|
|
23
|
-
$env:ENTITY_CLI_NAME = "cli"
|
|
24
|
-
& $BinPath @args
|
|
1
|
+
# Entity CLI wrapper script (Windows PowerShell)
|
|
2
|
+
|
|
3
|
+
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
|
4
|
+
$ProjectRoot = Split-Path -Parent $ScriptDir
|
|
5
|
+
$BinPath = Join-Path $ProjectRoot "bin\entity-cli.exe"
|
|
6
|
+
|
|
7
|
+
# Load language from .env
|
|
8
|
+
$Language = "ko"
|
|
9
|
+
$EnvFile = Join-Path $ProjectRoot ".env"
|
|
10
|
+
if (Test-Path $EnvFile) {
|
|
11
|
+
$LangLine = Get-Content $EnvFile | Where-Object { $_ -match '^LANGUAGE=' } | Select-Object -First 1
|
|
12
|
+
if ($LangLine) { $Language = $LangLine -replace '^LANGUAGE=', '' }
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
# Require prebuilt CLI binary
|
|
16
|
+
if (-not (Test-Path $BinPath)) {
|
|
17
|
+
if ($Language -eq "en") { Write-Host "X bin/entity-cli.exe not found" }
|
|
18
|
+
else { Write-Host "X bin/entity-cli.exe 파일이 없습니다" }
|
|
19
|
+
exit 1
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
Set-Location $ProjectRoot
|
|
23
|
+
$env:ENTITY_CLI_NAME = "cli"
|
|
24
|
+
& $BinPath @args
|