xdrpp / stc

Stellar transaction compiler

Home Page:https://xdrpp.github.io/stc/pkg/github.com/xdrpp/stc/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add support for providing arbitrary network passphrases at the command line rather than through ini files

leighmcculloch opened this issue · comments

What problem does your feature solve?

Use stc to build transactions for networks that are not the Stellar testnet or pubnet in scripts without writing files to disk.

What would you like to see?

stc -net take values other than test or pub that can be interpreted as the network passphrase for signing.

What alternatives are there?

The ability to pass a config file location at the command line so that config files do not need to be stored in arbitrary locations that a script may not have access to for creating temporary network configs.

cc @JakeUrban

Can you provide a bit more information about what you want and why the STCDIR environment variable is not enough? The issue with the network passphrase is that there's a bunch of other information that you probably want to change at the same time, like the location of the horizon server and the name of the native asset. In fact, by default stc will actually query the horizon server for the network passphrase and write it to the configuration file. (It's in the main network by default, but fetched dynamically from test in case it changes with a future testnet reset.)

The reason I'd like to know more is that there could be other more coherent ways of adding what you want. For example, if the issue is cleaning up temporary directories, perhaps it would be best to have an option like "stc --sandbox command" that runs command with STCDIR set to a fresh temporary directory and then cleans it up at the end. Or maybe you just need a more convenient way to edit configuration files on the command-line. The format was chosen to work with git config, so you should be able to say git config -f $STCDIR/custom.net net.network-id "My special network; 2020". There's also a tool ini in the stc git repository that provides a simplified interface like git config. It's mostly there to help test my ini file parsing/editing library, but might be of use. Arguably stc could have some command-line arguments for editing the configuration of networks.

I posted this request before I knew about STCDIR. Setting that to a temp dir and writing a file there is sufficient for what I'm doing.