[{"data":1,"prerenderedAt":428},["ShallowReactive",2],{"docs-\u002Fdocs\u002Freference\u002Fenvironment-variables":3},{"id":4,"title":5,"body":6,"description":420,"extension":421,"meta":422,"navigation":423,"path":424,"seo":425,"stem":426,"__hash__":427},"docs\u002Fdocs\u002Freference\u002Fenvironment-variables.md","Environment variables",{"type":7,"value":8,"toc":415},"minimark",[9,13,21,112,118,128,132,139,169,172,176,186,284,290,341,352,356,363,411],[10,11,5],"h1",{"id":12},"environment-variables",[14,15,16,20],"p",{},[17,18,19],"code",{},"sg"," reads three settings from the environment. Everything else comes from your specs.",[22,23,24,43],"table",{},[25,26,27],"thead",{},[28,29,30,34,37,40],"tr",{},[31,32,33],"th",{},"Variable",[31,35,36],{},"Default",[31,38,39],{},"Meaning",[31,41,42],{},"Rule",[44,45,46,65,95],"tbody",{},[28,47,48,54,59,62],{},[49,50,51],"td",{},[17,52,53],{},"SG_ENV",[49,55,56],{},[17,57,58],{},"development",[49,60,61],{},"Named environment",[49,63,64],{},"Must not be empty",[28,66,67,72,77,80],{},[49,68,69],{},[17,70,71],{},"SG_LOG_LEVEL",[49,73,74],{},[17,75,76],{},"info",[49,78,79],{},"Log detail",[49,81,82,85,86,85,88,91,92],{},[17,83,84],{},"debug",", ",[17,87,76],{},[17,89,90],{},"warn"," or ",[17,93,94],{},"error",[28,96,97,102,107,110],{},[49,98,99],{},[17,100,101],{},"SG_STATE_DIR",[49,103,104],{},[17,105,106],{},".sg",[49,108,109],{},"Where the ledger lives",[49,111,64],{},[14,113,114,115,117],{},"A bad value stops ",[17,116,19],{}," before any command runs:",[119,120,126],"pre",{"className":121,"code":123,"language":124,"meta":125},[122],"language-text","sg: loading configuration: SG_LOG_LEVEL must be one of debug, info, warn, error\n","text","",[17,127,123],{"__ignoreMap":125},[129,130,101],"h2",{"id":131},"sg_state_dir",[14,133,134,135,138],{},"The ledger is ",[17,136,137],{},"\u003CSG_STATE_DIR>\u002Fstate.db",". A relative value resolves against:",[140,141,142,159],"ul",{},[143,144,145,146,150,151,154,155,158],"li",{},"the ",[147,148,149],"strong",{},"spec file's directory"," for CLI commands, so ",[17,152,153],{},"sg machine plan --config ~\u002Festates\u002Flab\u002Fnode-a.yaml"," uses ",[17,156,157],{},"~\u002Festates\u002Flab\u002F.sg\u002Fstate.db"," wherever you run it from;",[143,160,145,161,164,165,168],{},[147,162,163],{},"launch directory"," for ",[17,166,167],{},"sg panel",".",[14,170,171],{},"An absolute value is used as is. Keep every spec for one estate pointing at the same ledger.",[129,173,175],{"id":174},"secrets-your-specs-name","Secrets your specs name",[14,177,178,179,182,183,185],{},"Specs never hold secrets. They hold the ",[147,180,181],{},"name"," of a variable, and ",[17,184,19],{}," reads it at run time.",[22,187,188,204],{},[25,189,190],{},[28,191,192,195,198,201],{},[31,193,194],{},"Spec field",[31,196,197],{},"Default name",[31,199,200],{},"Read by",[31,202,203],{},"When it's missing",[44,205,206,230,257],{},[28,207,208,213,218,227],{},[49,209,210],{},[17,211,212],{},"bootstrap.tailscale.auth_key_env",[49,214,215],{},[17,216,217],{},"TS_AUTHKEY",[49,219,220,223,224],{},[17,221,222],{},"sg machine plan"," and ",[17,225,226],{},"create",[49,228,229],{},"Refuses, naming the variable",[28,231,232,237,243,251],{},[49,233,234],{},[17,235,236],{},"services[].admin_password_env",[49,238,239],{},[240,241,242],"em",{},"(required, no default)",[49,244,245,223,248],{},[17,246,247],{},"sg application plan",[17,249,250],{},"deploy",[49,252,253,254],{},"Refuses with ",[17,255,256],{},"secret is unavailable: \u003CVAR>",[28,258,259,264,269,275],{},[49,260,261],{},[17,262,263],{},"services[].admin_user_env",[49,265,266],{},[240,267,268],{},"(optional)",[49,270,271,223,273],{},[17,272,247],{},[17,274,250],{},[49,276,277,278,91,281],{},"Falls back to ",[17,279,280],{},"postgres",[17,282,283],{},"default",[14,285,286,287,289],{},"Errors name the variable and never print its value. Export secrets in the shell that runs ",[17,288,19],{},", from your password manager rather than your shell history where you can:",[119,291,295],{"className":292,"code":293,"language":294,"meta":125,"style":125},"language-bash shiki shiki-themes github-dark-high-contrast","export TS_AUTHKEY=\"$(op read 'op:\u002F\u002Finfra\u002Ftailscale\u002Fauth-key')\"\nexport SG_PG_ADMIN_PASSWORD=\"$(op read 'op:\u002F\u002Finfra\u002Fshop-db\u002Fpassword')\"\n","bash",[17,296,297,324],{"__ignoreMap":125},[298,299,302,306,310,313,317,321],"span",{"class":300,"line":301},"line",1,[298,303,305],{"class":304},"sWyjQ","export",[298,307,309],{"class":308},"sMAXC"," TS_AUTHKEY",[298,311,312],{"class":304},"=",[298,314,316],{"class":315},"sTRMh","\"$(",[298,318,320],{"class":319},"s_sBn","op",[298,322,323],{"class":315}," read 'op:\u002F\u002Finfra\u002Ftailscale\u002Fauth-key')\"\n",[298,325,327,329,332,334,336,338],{"class":300,"line":326},2,[298,328,305],{"class":304},[298,330,331],{"class":308}," SG_PG_ADMIN_PASSWORD",[298,333,312],{"class":304},[298,335,316],{"class":315},[298,337,320],{"class":319},[298,339,340],{"class":315}," read 'op:\u002F\u002Finfra\u002Fshop-db\u002Fpassword')\"\n",[342,343,345],"note",{"kind":344},"warning",[14,346,347,348,351],{},"Systematic redaction of secrets across all command output is not finished in ",[17,349,350],{},"0.1.0-dev",". Review run output before pasting it anywhere public.",[129,353,355],{"id":354},"installer-variables","Installer variables",[14,357,358,359,362],{},"Read by ",[17,360,361],{},"install.sh"," only:",[22,364,365,375],{},[25,366,367],{},[28,368,369,371,373],{},[31,370,33],{},[31,372,36],{},[31,374,39],{},[44,376,377,395],{},[28,378,379,384,389],{},[49,380,381],{},[17,382,383],{},"SG_INSTALL_DIR",[49,385,386],{},[17,387,388],{},"~\u002F.local\u002Fbin",[49,390,391,392,394],{},"Where ",[17,393,19],{}," is installed",[28,396,397,402,405],{},[49,398,399],{},[17,400,401],{},"SG_VERSION",[49,403,404],{},"latest",[49,406,407,408],{},"Release tag to install, e.g. ",[17,409,410],{},"v0.1.0-dev",[412,413,414],"style",{},"html pre.shiki code .sWyjQ, html code.shiki .sWyjQ{--shiki-default:#FF9492}html pre.shiki code .sMAXC, html code.shiki .sMAXC{--shiki-default:#F0F3F6}html pre.shiki code .sTRMh, html code.shiki .sTRMh{--shiki-default:#ADDCFF}html pre.shiki code .s_sBn, html code.shiki .s_sBn{--shiki-default:#FFB757}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}",{"title":125,"searchDepth":326,"depth":326,"links":416},[417,418,419],{"id":131,"depth":326,"text":101},{"id":174,"depth":326,"text":175},{"id":354,"depth":326,"text":355},"The three settings sg reads from the environment, and the secret variables your specs name.","md",{},true,"\u002Fdocs\u002Freference\u002Fenvironment-variables",{"title":5,"description":420},"docs\u002Freference\u002Fenvironment-variables","yuYKhl0whTbQ1pyMJ0LX0DiVhefq7MAoUd-3__dlaeM",1796464240887]