unoverse 0.1.130 → 0.1.131

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -103,7 +103,15 @@ NODE
103
103
  # database.
104
104
  cmd_db_allow() {
105
105
  local cloud
106
- SELF_CMD="unoverse db-allow" cloud=$(_pick_ground "${1:-}") || {
106
+ # DIGITALOCEAN ONLY, and it is not an oversight. This joins a MANAGED DATABASE's
107
+ # trusted-source list through the DO API, and AWS has no equivalent to join: RDS
108
+ # reachability is a VPC security group, owned by Terraform and changed by `deploy`, not by
109
+ # a developer's laptop asking an API at runtime. Offering `db-allow aws` produced a
110
+ # ground-picker prompt for a cloud that would then have done nothing.
111
+ SELF_CMD="unoverse db-allow" \
112
+ GROUNDS_ONLY="digitalocean" \
113
+ GROUNDS_ONLY_WHY="On AWS the database is reached through its VPC security group, which the ground owns — change it in infra/aws and run ${BOLD}unoverse deploy aws${NC}." \
114
+ cloud=$(_pick_ground "${1:-}") || {
107
115
  [ -z "${1:-}" ] && [ ! -d "$ROOT/infra" ] && fail "No ground here. There is no database to reach"
108
116
  return 1
109
117
  }
@@ -210,11 +218,23 @@ _pick_ground() {
210
218
  *) fail "Unknown ground '$want'. Use ${BOLD}digitalocean${NC} or ${BOLD}aws${NC}" >&2; return 1 ;;
211
219
  esac
212
220
 
221
+ # A command may not apply to every cloud. `GROUNDS_ONLY` names the ones it does, so a
222
+ # ground that cannot answer is never offered as a choice and never named in the
223
+ # "say which" prompt. Unset means all of them, which is every other caller.
213
224
  local configured=()
214
225
  for g in digitalocean aws; do
215
- [ -f "$ROOT/infra/$g/terraform.tfvars" ] && configured+=("$g")
226
+ [ -f "$ROOT/infra/$g/terraform.tfvars" ] || continue
227
+ if [ -n "${GROUNDS_ONLY:-}" ] && [[ " ${GROUNDS_ONLY} " != *" $g "* ]]; then continue; fi
228
+ configured+=("$g")
216
229
  done
217
230
 
231
+ # Asked for a ground this command cannot serve: say so plainly rather than "no such
232
+ # ground here", which sends someone off to create one that would not have helped.
233
+ if [ -n "$want" ] && [ -n "${GROUNDS_ONLY:-}" ] && [[ " ${GROUNDS_ONLY} " != *" $want "* ]]; then
234
+ fail "${SELF_CMD:-This command} does not apply to $want. ${GROUNDS_ONLY_WHY:-}" >&2
235
+ return 1
236
+ fi
237
+
218
238
  if [ -n "$want" ]; then
219
239
  for g in "${configured[@]}"; do
220
240
  [ "$g" = "$want" ] && { printf '%s' "$want"; return 0; }
@@ -229,7 +249,9 @@ _pick_ground() {
229
249
  *)
230
250
  # Two grounds and no name. Refuse rather than pick: this decides which cloud a
231
251
  # destroy lands on.
232
- fail "Two grounds are configured. Say which: ${BOLD}${SELF_CMD:-unoverse deploy} digitalocean${NC} or ${BOLD}${SELF_CMD:-unoverse deploy} aws${NC}" >&2
252
+ # Names the grounds THIS command can actually serve, not both clouds unconditionally:
253
+ # offering a choice that would be refused is worse than not offering it.
254
+ fail "Two grounds are configured. Say which: ${BOLD}${SELF_CMD:-unoverse deploy} ${configured[0]}${NC} or ${BOLD}${SELF_CMD:-unoverse deploy} ${configured[1]}${NC}" >&2
233
255
  return 1
234
256
  ;;
235
257
  esac
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unoverse",
3
- "version": "0.1.130",
3
+ "version": "0.1.131",
4
4
  "description": "The Unoverse front door — create a Studio project, a universe, or a client app, and launch Studio.",
5
5
  "license": "SEE LICENSE IN README.md",
6
6
  "type": "module",