Initial commit
This commit is contained in:
36
deploy/make-env.ps1
Normal file
36
deploy/make-env.ps1
Normal file
@@ -0,0 +1,36 @@
|
||||
param(
|
||||
[string]$WorkspaceRoot = "/workspaces",
|
||||
[string]$StatePath = "/app/data/state.json"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$root = Split-Path -Parent (Split-Path -Parent $MyInvocation.MyCommand.Path)
|
||||
$envPath = Join-Path $root ".env"
|
||||
|
||||
$secureToken = Read-Host "Telegram bot token" -AsSecureString
|
||||
$tokenPtr = [Runtime.InteropServices.Marshal]::SecureStringToBSTR($secureToken)
|
||||
try {
|
||||
$token = [Runtime.InteropServices.Marshal]::PtrToStringBSTR($tokenPtr)
|
||||
}
|
||||
finally {
|
||||
if ($tokenPtr -ne [IntPtr]::Zero) {
|
||||
[Runtime.InteropServices.Marshal]::ZeroFreeBSTR($tokenPtr)
|
||||
}
|
||||
}
|
||||
$allowedIds = Read-Host "Allowed Telegram user ids (comma-separated; leave blank for /whoami only)"
|
||||
|
||||
@"
|
||||
TELEGRAM_BOT_TOKEN=$token
|
||||
ALLOWED_TELEGRAM_USER_IDS=$allowedIds
|
||||
BOT_STATE_PATH=$StatePath
|
||||
BOT_WORKSPACE_ROOT=$WorkspaceRoot
|
||||
CODEX_BIN=codex
|
||||
CODEX_TIMEOUT_SECONDS=1800
|
||||
CODEX_READONLY_SANDBOX=read-only
|
||||
CODEX_WRITE_SANDBOX=workspace-write
|
||||
CODEX_RESUME_JSON_FLAG_STYLE=before_resume
|
||||
ALLOW_PLAIN_TEXT=true
|
||||
"@ | Set-Content -Path $envPath -Encoding UTF8
|
||||
|
||||
Write-Host "Wrote $envPath"
|
||||
Reference in New Issue
Block a user