Rust implementation of SHV broker
Use CI build on releases
cargo build --release --all-features
Print default config
./shvbroker --print-config
Edit config, save config, run broker
./shvbroker --config myconfig.yaml
shvbroker_migrate_legacy is a command-line tool used to convert legacy C++ SHVBroker configuration and access database files into the YAML and SQLite formats used by shvbroker-rs.
This migration process includes:
- Converting the legacy
.cfgconfiguration file toshvbroker.yml - Migrating the legacy Access-style
.dbfile toshvbroker.sqlite - Preserving users, mounts, and roles data in the new format
shvbroker_migrate_legacy --legacy-config <LEGACY_CONFIG_PATH> [--result-config <RESULT_CONFIG_PATH>]| Flag | Description |
|---|---|
--legacy-config <PATH> |
Path to the legacy SHVBroker configuration file (in CPON format, e.g., shvbroker.cfg). |
| Flag | Description |
|---|---|
--result-config <PATH> |
Output path for the converted YAML configuration file. If not specified, the tool will write shvbroker.yml in the same directory as the legacy file. |
shvbroker_migrate_legacy --legacy-config /etc/shvbroker/shvbroker.cfgWhat this does:
- Reads the legacy configuration from
/etc/shvbroker/shvbroker.cfg. - Writes the converted YAML to
/etc/shvbroker/shvbroker.yml(same directory by default). - If the legacy configuration refers to an access DB (for example
shvbroker.cfg.db), migrates it toshvbroker.sqlitein the configured data directory.
shvbroker_migrate_legacy \
--legacy-config /etc/shvbroker/shvbroker.cfg \
--result-config /tmp/new_shvbroker.ymlThis saves the converted configuration to /tmp/new_shvbroker.yml instead of the default shvbroker.yml in the config directory.
If the legacy configuration enables access database (i.e. use_access_db: true in the migrated config), the tool will:
- Determine the data directory:
- If the
data_directoryin the newbroker_configis a relative path, it will be joined with the config file's directory. - If
data_directoryis absolute, it will be used as-is.
- If the
- Locate the legacy DB file:
- Uses the database field from the legacy SQL config if present, extracting only the filename (e.g.
shvbroker.cfg.db). - If missing, defaults to
shvbroker.cfg.db.
- Uses the database field from the legacy SQL config if present, extracting only the filename (e.g.
- Create a new SQLite database
shvbroker.sqlitein the data directory. - Migrate the following tables/objects from the legacy DB into the new DB:
- users
- mounts
- roles
The tool reads the legacy DB in read-only mode and writes the new DB using the updated schema.