urbit/pkg/arvo/ted/gcp/is-configured.hoon
J c1b259af5b interface, gcp: don't spam the console with 500s
Options here were: make the get-token thread try to return a unit, or
write a different thread to check whether GCP Storage seemed to be
configured and poll on that thread, or move the whole thing into a Gall
app.

The compromise between time-to-implement and overall cleanliness seemed
to be to write a different thread that just checks whether the settings
fields have been poked. Unfortunately this means GcpManager is now a
somewhat hefty JavaScript state machine.

Took out the logic to check whether S3 was configured in GcpManager,
since it was really only there to prevent spamming the console with
500s. If you have both S3 and GCP Storage configured for some reason,
you will now use GCP per the logic in useStorage.
2021-02-26 23:42:57 +00:00

50 lines
839 B
Plaintext

:: Tells whether GCP Storage appears to be configured.
::
:: Thread since it needs to be called from Landscape.
::
::
/- gcp, spider, settings
/+ strandio
=, strand=strand:spider
=, enjs:format
^- thread:spider
|^
|= *
=/ m (strand ,vase)
^- form:m
;< has=? bind:m
%: has-settings
%client-email
%private-key
%private-key-id
%token-uri
~
==
%- pure:m
!>
%+ frond %gcp-configured
b+has
::
++ has-settings
|= set=(list @tas)
=/ m (strand ?)
^- form:m
?~ set
(pure:m %.y)
;< has=? bind:m (has-setting i.set)
?. has
(pure:m %.n)
;< has=? bind:m (has-settings t.set)
(pure:m has)
::
++ has-setting
|= key=@tas
=/ m (strand ?)
^- form:m
;< has=? bind:m
%+ scry:strandio ?
/gx/settings-store/has-entry/gcp-store/[key]/noun
(pure:m has)
::
--