Server text passed to connect.
Contents of a .creds file, not a path.
KV bucket name, e.g. avenabox.
Key to write, e.g. <site>.<box>.<source>.config.
Value passed to JSON.stringify.
Optionalshared: NatsService | nullOpen connection to reuse, such as the page's own. Optional.
true if the value was written, false if connecting or writing failed.
Writes a configuration object to KV as JSON.
The object is serialized with two-space indentation. Errors are logged to the console and reported through the return value instead of being thrown.
Uses
sharedwhen it is given and still open, which saves the connection setup (several round trips on a slow link); it is left open. Otherwise a new connection is opened and always closed before returning.