Skip to content

Commit bfded0f

Browse files
committed
feat(registry): Replace custom implementation by wasm_pkg_client
1 parent 671c387 commit bfded0f

9 files changed

Lines changed: 801 additions & 494 deletions

File tree

Cargo.lock

Lines changed: 733 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ clap = { version = "4.6.4", features = ["derive"] }
1414
cron = "0.17.0"
1515
dotenvy = "0.15.7"
1616
fjall = "3.1.8"
17+
futures-util = "0.3.33"
1718
hashbrown = "0.17.1"
1819
hotpath = "0.22.0"
1920
reqwest = { version = "0.13.4", features = ["hickory-dns"] }
@@ -37,6 +38,7 @@ twilight-http = { git = "https://github.com/wpbs-rs/twilight/", features = [
3738
twilight-model = { git = "https://github.com/wpbs-rs/twilight/" }
3839
url = "2.5.8"
3940
uuid = "1.24.0"
41+
wasm-pkg-client = "0.16.0"
4042
wasmtime = "47.0.2"
4143
wasmtime-wasi = "47.0.2"
4244
wasmtime-wasi-http = "47.0.2"

src/cli.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,8 @@ pub struct Cli {
3636
#[arg(default_value = "./plugins", short, long, value_name = "DIRECTORY PATH", help = "The path to the program its plugin directory", long_help = None)]
3737
pub plugin_directory: PathBuf,
3838

39-
#[arg(action=ArgAction::Set, default_value_t = true, short = 'C', long, value_name = "BOOL", help = "Enable the usage of cached plugins", long_help = None, hide_possible_values = true)]
40-
pub cache: bool,
41-
4239
#[arg(default_value = "./database", short, long, value_name = "DIRECTORY PATH", help = "The path to the program its database", long_help = None)]
4340
pub database_directory: PathBuf,
44-
45-
#[arg(default_value_t = 15, short = 't', long, value_name = "SECONDS", help = "The amount of seconds after which the HTTP client should timeout", long_help = None)]
46-
pub http_client_timeout_seconds: u64,
4741
}
4842

4943
#[derive(Args)]

src/config/plugins.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ pub mod permissions;
1313
#[derive(Deserialize)]
1414
pub struct ConfigPlugin {
1515
pub plugin: String,
16-
pub cache: Option<bool>,
1716
#[serde(default)]
1817
pub permissions: PluginPermissions,
1918
#[serde(default)]

src/http.rs

Lines changed: 0 additions & 29 deletions
This file was deleted.

src/http/registry.rs

Lines changed: 0 additions & 34 deletions
This file was deleted.

src/main.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ use tracing::{debug, error, info, warn};
2626
mod cli;
2727
mod config;
2828
mod database;
29-
mod http;
3029
mod registry;
3130
mod runtime;
3231
mod services;
@@ -113,9 +112,7 @@ async fn main() -> Result<ExitCode> {
113112
);
114113

115114
let setup_result = setup(
116-
cli.http_client_timeout_seconds,
117115
cli.plugin_directory,
118-
cli.cache,
119116
channels.services,
120117
channels.runtime,
121118
config,
@@ -181,21 +178,14 @@ fn message_handler(
181178
}
182179

183180
async fn setup(
184-
http_client_timeout_seconds: u64,
185181
plugin_directory_path: PathBuf,
186-
cache: bool,
187182
service_channels: ChannelsServices,
188183
runtime_channels: ChannelsRuntime,
189184
config: Config,
190185
secrets: Secrets,
191186
) -> Result<()> {
192-
let available_plugins = registry::registry_get_plugins(
193-
http_client_timeout_seconds,
194-
config.plugins,
195-
plugin_directory_path.clone(),
196-
cache,
197-
)
198-
.await?;
187+
let available_plugins =
188+
registry::registry_get_plugins(config.plugins, &plugin_directory_path).await?;
199189

200190
services::setup(config.services, secrets.services, service_channels).await?;
201191

0 commit comments

Comments
 (0)