mirror of
https://github.com/BaaRai/ARTEX.git
synced 2026-12-01 20:23:55 +08:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ce10819cc8 | ||
|
|
7bfe3fa0b5 |
+1348
-1347
File diff suppressed because it is too large
Load Diff
+14
-1
@@ -43,12 +43,23 @@ stamp_version(){
|
||||
fi
|
||||
ok "Build identity: ${BUILD_VERSION}${BUILD_REVISION:+ (${BUILD_REVISION:0:12})}"
|
||||
}
|
||||
# normalize_env rewrites a CRLF .env as LF. A Windows checkout with
|
||||
# core.autocrlf=true materializes CRLF, and every value then carries a trailing
|
||||
# \r: compose reports an empty required variable and PostgreSQL receives a
|
||||
# password with a stray CR. One conversion keeps the rest of the script simple.
|
||||
normalize_env(){
|
||||
[ -f .env ] || return 0
|
||||
grep -q $'\r' .env 2>/dev/null || return 0
|
||||
sed -i.bak 's/\r$//' .env && rm -f .env.bak
|
||||
ok ".env converted from CRLF to LF"
|
||||
}
|
||||
|
||||
# ensure_runner_token fills ARTEX_RUNNER_TOKEN in .env once. The panel and the
|
||||
# runner authenticate the internal execution API with it; an empty value makes
|
||||
# the panel fail closed, so the token is generated with the rest of the setup.
|
||||
ensure_runner_token(){
|
||||
[ -f .env ] || return 0
|
||||
grep -q '^ARTEX_RUNNER_TOKEN=.' .env && return 0
|
||||
grep -q '^ARTEX_RUNNER_TOKEN=[^[:space:]]' .env && return 0
|
||||
set_env ARTEX_RUNNER_TOKEN "$(rand)"
|
||||
ok "ARTEX_RUNNER_TOKEN generated"
|
||||
}
|
||||
@@ -153,6 +164,7 @@ ensure_buildx(){
|
||||
install_docker(){
|
||||
ensure_docker
|
||||
ensure_buildx
|
||||
normalize_env
|
||||
if [ ! -f .env ]; then
|
||||
cp .env.example .env 2>/dev/null || true
|
||||
local pw key
|
||||
@@ -161,6 +173,7 @@ install_docker(){
|
||||
sed -i.bak "s|^POSTGRES_PASSWORD=.*|POSTGRES_PASSWORD=$(sed_repl "$pw")|" .env
|
||||
sed -i.bak "s|^ANTHROPIC_API_KEY=.*|ANTHROPIC_API_KEY=$(sed_repl "$key")|" .env
|
||||
rm -f .env.bak
|
||||
normalize_env
|
||||
ok ".env generated (POSTGRES_PASSWORD set)"
|
||||
else
|
||||
info "reusing existing .env"
|
||||
|
||||
@@ -47,12 +47,23 @@ stamp_version(){
|
||||
ok "Build identity: ${BUILD_VERSION}${BUILD_REVISION:+ (${BUILD_REVISION:0:12})}"
|
||||
}
|
||||
|
||||
# normalize_env rewrites a CRLF .env as LF. A Windows checkout with
|
||||
# core.autocrlf=true materializes CRLF, and every value then carries a trailing
|
||||
# \r: compose reports an empty required variable and PostgreSQL receives a
|
||||
# password with a stray CR.
|
||||
normalize_env(){
|
||||
[ -f .env ] || return 0
|
||||
grep -q $'\r' .env 2>/dev/null || return 0
|
||||
sed -i.bak 's/\r$//' .env && rm -f .env.bak
|
||||
ok ".env converted from CRLF to LF"
|
||||
}
|
||||
|
||||
# ensure_runner_token fills ARTEX_RUNNER_TOKEN in .env once. The panel and the
|
||||
# runner authenticate the internal execution API with it; an empty value makes
|
||||
# the panel fail closed, so an existing .env gets one before the upgrade.
|
||||
ensure_runner_token(){
|
||||
[ -f .env ] || return 0
|
||||
grep -q '^ARTEX_RUNNER_TOKEN=.' .env && return 0
|
||||
grep -q '^ARTEX_RUNNER_TOKEN=[^[:space:]]' .env && return 0
|
||||
set_env ARTEX_RUNNER_TOKEN "$(rand)"
|
||||
ok "ARTEX_RUNNER_TOKEN generated"
|
||||
}
|
||||
@@ -84,6 +95,7 @@ update_docker(){
|
||||
|| die "docker buildx not detected; the image build needs it (see the Docker section of the README)"
|
||||
[ -f .env ] || die ".env not found; run ./install.sh first to complete the initial deployment"
|
||||
|
||||
normalize_env
|
||||
ensure_runner_token
|
||||
# Touch only artex and artex-runner: postgres is pinned to 16-alpine and does not
|
||||
# need upgrading along (pulling it wastes bandwidth, and a major version bump
|
||||
|
||||
Reference in New Issue
Block a user