Monorepo for Aesthetic.Computer aesthetic.computer
4
fork

Configure Feed

Select the types of activity you want to include in your feed.

lith/deploy.fish: make vault env upload optional

If aesthetic-computer-vault/lith/.env is missing, preserve the existing
/opt/ac/system/.env on the remote and deploy only code. Populating the
vault later still works as before (the env gets uploaded).

+18 -12
+18 -12
lith/deploy.fish
··· 105 105 exit 1 106 106 end 107 107 108 + # Env upload is optional: if the vault has a lith/.env we upload it, otherwise 109 + # we trust the env already present on the server at /opt/ac/system/.env. 110 + set UPLOAD_ENV true 108 111 if not test -f $SERVICE_ENV 109 - echo -e "$RED x Service env not found: $SERVICE_ENV$NC" 110 - exit 1 111 - end 112 - 113 - if not rg -q '^DEPLOY_SECRET=' $SERVICE_ENV 112 + echo -e "$YELLOW Service env not found: $SERVICE_ENV$NC" 113 + echo -e "$YELLOW Skipping env upload; preserving existing /opt/ac/system/.env on the server.$NC" 114 + set UPLOAD_ENV false 115 + else if not rg -q '^DEPLOY_SECRET=' $SERVICE_ENV 114 116 echo -e "$RED x DEPLOY_SECRET missing from $SERVICE_ENV$NC" 115 - echo -e "$YELLOW lith reads this file via /opt/ac/system/.env on the server.$NC" 117 + echo -e "$YELLOW Remove the file or add DEPLOY_SECRET. lith reads this file via /opt/ac/system/.env on the server.$NC" 116 118 exit 1 117 119 end 118 120 ··· 160 162 git reset --hard origin/$TARGET_BRANCH --quiet && \ 161 163 git rev-parse HEAD > system/public/.commit-ref" 162 164 163 - # Upload env 164 - echo -e "$GREEN-> Uploading environment...$NC" 165 - # Note: lith.service reads EnvironmentFile=/opt/ac/system/.env, so the 166 - # canonical vault source lives at aesthetic-computer-vault/lith/.env and is 167 - # uploaded into system/.env on the remote host. 168 - scp -i $SSH_KEY $SERVICE_ENV $LITH_USER@$TARGET_HOST:$REMOTE_DIR/system/.env 165 + # Upload env (only if the vault has one — otherwise keep the remote's existing env) 166 + # Note: lith.service reads EnvironmentFile=/opt/ac/system/.env, so the canonical 167 + # vault source lives at aesthetic-computer-vault/lith/.env and is uploaded into 168 + # system/.env on the remote host. 169 + if test $UPLOAD_ENV = true 170 + echo -e "$GREEN-> Uploading environment...$NC" 171 + scp -i $SSH_KEY $SERVICE_ENV $LITH_USER@$TARGET_HOST:$REMOTE_DIR/system/.env 172 + else 173 + echo -e "$GREEN-> Using existing remote environment (no local vault env to upload).$NC" 174 + end 169 175 170 176 # Install deps 171 177 echo -e "$GREEN-> Installing dependencies...$NC"