diff --git a/file-exchange/tests/test0.toml b/file-exchange/tests/test0.toml index 78a0599..28c6a34 100644 --- a/file-exchange/tests/test0.toml +++ b/file-exchange/tests/test0.toml @@ -1,8 +1,8 @@ [server] -bundles = ["QmeaPp764FjQjPB66M9ijmQKmLhwBpHQhA7dEbH2FA1j3v:"] +initial_bundles = ["QmeaPp764FjQjPB66M9ijmQKmLhwBpHQhA7dEbH2FA1j3v:"] admin_auth_token = "slayyy" admin_host_and_port = "0.0.0.0:5664" -price_per_byte = 1 +default_price_per_byte = 1 ipfs_gateway = "https://ipfs.network.thegraph.com" log_format = "Full" [server.storage_method.LocalFiles] diff --git a/file-exchange/tests/test1.toml b/file-exchange/tests/test1.toml index e1314dd..3acad3c 100644 --- a/file-exchange/tests/test1.toml +++ b/file-exchange/tests/test1.toml @@ -1,12 +1,12 @@ [server] -bundles = [ +initial_bundles = [ "QmVPPWWaraEvoc4LCrYXtMbL13WPNbnuXV2yo7W8zexFGq:", "QmeD3dRVV6Gs84TRwiNj3tLt9mBEMVqy3GoWm7WN8oDzGz:", "QmTSwj1BGkkmVSnhw6uEGkcxGZvP5nq4pDhzHjwJvsQC2Z:" ] admin_auth_token = "kueen" admin_host_and_port = "0.0.0.0:5665" -price_per_byte = 1 +default_price_per_byte = 1 ipfs_gateway = "https://ipfs.network.thegraph.com" log_format = "Pretty" [server.storage_method.LocalFiles] diff --git a/file-service/src/config.rs b/file-service/src/config.rs index fd34b86..261ee09 100644 --- a/file-service/src/config.rs +++ b/file-service/src/config.rs @@ -32,12 +32,12 @@ pub struct ServerArgs { // Taking from config right now, later can read from DB table for managing server states #[arg( long, - value_name = "BUNDLES", - env = "BUNDLES", + value_name = "initial-bundles", + env = "INITIAL_BUNDLES", value_delimiter = ',', - help = "Comma separated list of IPFS hashes and shared prefix of files in the bundles (empty if just in main_directory) to serve upon start-up; format: [ipfs_hash:prefix]" + help = "Comma separated list of IPFS hashes and shared prefix of files in the bundles (empty if just in main_directory) to serve upon start-up; the list can be managed through the /admin API without service restart.\nformat: [ipfs_hash:prefix]" )] - pub bundles: Vec, + pub initial_bundles: Vec, #[clap( long, value_name = "admin-auth-token", @@ -48,7 +48,7 @@ pub struct ServerArgs { //TODO: More complex price management #[arg( long, - value_name = "ADMIN_ADDR", + value_name = "admin-addr", default_value = "0.0.0.0/6700", env = "ADMIN_ADDR", help = "Expost Admin service at address with both host and port" @@ -56,7 +56,7 @@ pub struct ServerArgs { pub admin_host_and_port: SocketAddr, #[arg( long, - value_name = "IPFS_GATEWAY_URL", + value_name = "ipfs-gateway-url", default_value = "https://ipfs.network.thegraph.com", env = "IPFS_GATEWAY_URL", help = "IPFS gateway to interact with" @@ -66,7 +66,7 @@ pub struct ServerArgs { pub storage_method: StorageMethod, #[arg( long, - value_name = "LOG_FORMAT", + value_name = "log-format", env = "LOG_FORMAT", help = "Support logging formats: pretty, json, full, compact", long_help = "pretty: verbose and human readable; json: not verbose and parsable; compact: not verbose and not parsable; full: verbose and not parsible", @@ -76,12 +76,12 @@ pub struct ServerArgs { //TODO: More complex price management #[arg( long, - value_name = "PRICE_PER_BYTE", + value_name = "default-price-per-byte", default_value = "1", - env = "PRICE_PER_BYTE", - help = "Price per byte in GRT" + env = "DEFAULT_PRICE_PER_BYTE", + help = "Default price per byte in GRT" )] - pub price_per_byte: f64, + pub default_price_per_byte: f64, } #[derive(clap::ValueEnum, Clone, Debug, Serialize, Deserialize, Default)] diff --git a/file-service/src/file_server/cost.rs b/file-service/src/file_server/cost.rs index eeb6080..641d359 100644 --- a/file-service/src/file_server/cost.rs +++ b/file-service/src/file_server/cost.rs @@ -28,7 +28,7 @@ impl Query { .state .config .server - .price_per_byte; + .default_price_per_byte; let cost_models = deployments .into_iter() .map(|s| GraphQlCostModel { @@ -60,7 +60,7 @@ impl Query { .state .config .server - .price_per_byte; + .default_price_per_byte; GraphQlCostModel { deployment, price_per_byte: price, diff --git a/file-service/src/file_server/mod.rs b/file-service/src/file_server/mod.rs index 95f8cb2..c9ff663 100644 --- a/file-service/src/file_server/mod.rs +++ b/file-service/src/file_server/mod.rs @@ -91,7 +91,7 @@ pub async fn initialize_server_context(config: Config) -> Result