fix: pass host timezone to container and reject UTC-suffixed timestamps (#371)
Containers had no TZ set, so any time-aware code inside ran in UTC while the host interpreted bare timestamps as local time. Now TIMEZONE from config.ts is passed via -e TZ= to the container args. Also rejects Z-suffixed or offset-suffixed timestamps in the container's schedule_task validation, since bare timestamps are expected to be local time and silently accepting UTC suffixes would cause an offset mismatch. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -13,6 +13,7 @@ import {
|
||||
DATA_DIR,
|
||||
GROUPS_DIR,
|
||||
IDLE_TIMEOUT,
|
||||
TIMEZONE,
|
||||
} from './config.js';
|
||||
import { readEnvFile } from './env.js';
|
||||
import { resolveGroupFolderPath, resolveGroupIpcPath } from './group-folder.js';
|
||||
@@ -187,6 +188,9 @@ function readSecrets(): Record<string, string> {
|
||||
function buildContainerArgs(mounts: VolumeMount[], containerName: string): string[] {
|
||||
const args: string[] = ['run', '-i', '--rm', '--name', containerName];
|
||||
|
||||
// Pass host timezone so container's local time matches the user's
|
||||
args.push('-e', `TZ=${TIMEZONE}`);
|
||||
|
||||
// Run as host user so bind-mounted files are accessible.
|
||||
// Skip when running as root (uid 0), as the container's node user (uid 1000),
|
||||
// or when getuid is unavailable (native Windows without WSL).
|
||||
|
||||
Reference in New Issue
Block a user