ChainMovers / suibase

Sui development environment and cookbook.
https://suibase.io
Apache License 2.0
35 stars 6 forks source link

sui-base.yaml (per workdir configuration) #6

Closed mario4tier closed 1 year ago

mario4tier commented 1 year ago

Problem Statement In the Rust demo-app, the URL used by SuiClient is currently setup for "localnet".

When trying to adapt the demo to work with an "active" sui-base workdir (can change from one execution to another), it is inconvenient because the app have to figure out how every possible "workdir name" translate to which URL.

Solution Distinct configurable value like RPC_URL, WS_URL need to be provided in a sui-base.yaml in every workdir.

The configuration should be generated (once) with default, and allowed to be further modified by the developer.

Eventually, all this should end up to be "well documented" since it is about building a common foundation for many SDK to count on.

(I think Frank was suggesting something similar recently coming from a different angle).

mario4tier commented 1 year ago

On Rust, access to the sui-base.yaml will be facilitated by the "sui-base-helper" crate (work in progress).

Alternatively, any SDK/app may choose to access the information through ENV variables or directly parsing the .yaml at the expected location. Example:

~/sui-base/workdirs/active/sui-base.yaml  <- For the one activated for 'asui'
~/sui-base/workdirs/localnet/sui-base.yaml
~/sui-base/workdirs/devnet/sui-base.yaml
mario4tier commented 1 year ago

Variables in sui-base.yaml appears as "$CFG_" in scripts.

Defaults are in "~/sui-base/scripts/defaults//sui-base.yaml

User overrides are in "~/sui-base/workdirs//sui-base.yaml