Skip to content

Commit

Permalink
Show possible values for configuring db-type (#148)
Browse files Browse the repository at this point in the history
* change db-type args to kebab case, update help to show all possible values


Co-authored-by: John Adler <adlerjohn@users.noreply.github.com>

Co-authored-by: John Adler <adlerjohn@users.noreply.github.com>
  • Loading branch information
Voxelot and adlerjohn authored Jan 22, 2022
1 parent 9f7f710 commit 53452cf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion fuel-core/src/args.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::service::{Config, DbType};
use std::{env, io, net, path::PathBuf, string::ToString};
use structopt::StructOpt;
use strum::VariantNames;
use tracing_subscriber::filter::EnvFilter;

lazy_static::lazy_static! {
Expand All @@ -23,7 +24,7 @@ pub struct Opt {
)]
pub database_path: PathBuf,

#[structopt(long = "db-type", default_value = "RocksDb")]
#[structopt(long = "db-type", default_value = "rocks-db", possible_values = &DbType::VARIANTS, case_insensitive = true)]
pub database_type: DbType,

/// Specify either an alias to a built-in configuration or filepath to a JSON file.
Expand Down
5 changes: 3 additions & 2 deletions fuel-core/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use std::{
path::PathBuf,
sync::Arc,
};
use strum_macros::{Display, EnumString};
use strum_macros::{Display, EnumString, EnumVariantNames};
use thiserror::Error;
use tokio::task::JoinHandle;

Expand All @@ -40,7 +40,8 @@ impl Config {
}
}

#[derive(Clone, Debug, PartialEq, EnumString, Display)]
#[derive(Clone, Debug, Display, PartialEq, EnumString, EnumVariantNames)]
#[strum(serialize_all = "kebab_case")]
pub enum DbType {
InMemory,
RocksDb,
Expand Down

0 comments on commit 53452cf

Please sign in to comment.