Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ test-supabase: install-pkgs rebuild-cmake download-sdk
(cd build && ninja check_supabase)

# From https://app.supabase.com/project/voisfafsfolxhqpkudzd/settings/auth
ARTEMIS_HOST := voisfafsfolxhqpkudzd.supabase.co
ARTEMIS_HOST := artemis-api.toit.io
ARTEMIS_ANON := eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InZvaXNmYWZzZm9seGhxcGt1ZHpkIiwicm9sZSI6ImFub24iLCJpYXQiOjE2NzMzNzQyNDEsImV4cCI6MTk4ODk1MDI0MX0.dmfxNl5WssxnZ8jpvGJeryg4Fd47fOcrlZ8iGrHj2e4
ARTEMIS_CERTIFICATE := Baltimore CyberTrust Root

Expand Down
2 changes: 1 addition & 1 deletion src/cli/cmds/config.toit
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ create-server-config-commands -> List:
Example "Add a local Supabase broker (anon-token is truncated):"
--arguments="my-local-supabase 127.0.0.1:54321 eyJhb...6XHc",
Example "Add a Supabase broker with a certificate (anon-token is truncated):"
--arguments="my-remote-broker --certificate=\"Baltimore CyberTrust Root\" voisfafsfolxhqpkudzd.subabase.co eyJh...j2e4",
--arguments="my-remote-broker --certificate=\"Baltimore CyberTrust Root\" artemis-api.toit.io eyJh...j2e4",
]
--run=:: add-supabase it

Expand Down
14 changes: 14 additions & 0 deletions src/cli/fleet.toit
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,20 @@ class FleetFile:
default-broker-config.name: default-broker-config,
}

servers.map --in-place: | _ server-config/ServerConfig |
if server-config is not ServerConfigSupabase:
server-config
else:
// If the server config is for supabase, and it uses the original
// server URI, update it to use the new one.
supabase-config := server-config as ServerConfigSupabase
if supabase-config.host == ORIGINAL-SUPABASE-SERVER-URI:
cli.ui.emit --info
"Using updated Artemis server URI: $DEFAULT-ARTEMIS-SERVER-CONFIG.host"
supabase-config.with --host=DEFAULT-ARTEMIS-SERVER-CONFIG.host
else:
supabase-config

recovery-urls := fleet-contents.get "recovery-urls" --if-absent=: []

return FleetFile
Expand Down
8 changes: 6 additions & 2 deletions src/cli/server-config.toit
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ import encoding.base64

export ServerConfig ServerConfigSupabase ServerConfigHttp

ORIGINAL-SUPABASE-SERVER-URI ::= "voisfafsfolxhqpkudzd.supabase.co"

DEFAULT-ARTEMIS-SERVER-CONFIG ::= ServerConfigSupabase
"Artemis"
--host="voisfafsfolxhqpkudzd.supabase.co"
--host="artemis-api.toit.io"
--anon="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InZvaXNmYWZzZm9seGhxcGt1ZHpkIiwicm9sZSI6ImFub24iLCJpYXQiOjE2NzMzNzQyNDEsImV4cCI6MTk4ODk1MDI0MX0.dmfxNl5WssxnZ8jpvGJeryg4Fd47fOcrlZ8iGrHj2e4"
--root-certificate-name="Baltimore CyberTrust Root"

Expand Down Expand Up @@ -50,9 +52,11 @@ get-server-from-config --cli/Cli --name/string -> ServerConfig?:

json-map := servers[name]

return ServerConfig.from-json name json-map
result := ServerConfig.from-json name json-map
--der-deserializer=: base64.decode it

return result

get-servers-from-config --cli/Cli -> List:
config := cli.config
default-name := DEFAULT-ARTEMIS-SERVER-CONFIG.name
Expand Down
9 changes: 9 additions & 0 deletions src/shared/server-config.toit
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,15 @@ class ServerConfigSupabase extends ServerConfig implements supabase.ServerConfig
compute-cache-key_ -> string:
return host

with --host/string -> ServerConfigSupabase:
return ServerConfigSupabase
name
--host=host
--anon=anon
--root-certificate-name=root-certificate-name
--root-certificate-der=root-certificate-der
--poll-interval=poll-interval

/**
A broker configuration for an HTTP-based broker.

Expand Down
Loading