1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-11-26 10:44:51 +03:00

Remove dependency on mas-email and lettre in mas-config

This commit is contained in:
Quentin Gliech
2022-12-15 12:27:12 +01:00
parent 5cc17921e0
commit fbbb842255
8 changed files with 90 additions and 104 deletions

View File

@@ -12,17 +12,17 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use anyhow::Context;
use clap::Parser;
use hyper::{Response, Uri};
use mas_config::PolicyConfig;
use mas_handlers::HttpClientFactory;
use mas_http::HttpServiceExt;
use mas_policy::PolicyFactory;
use tokio::io::AsyncWriteExt;
use tower::{Service, ServiceExt};
use tracing::info;
use crate::util::policy_factory_from_config;
#[derive(Parser, Debug)]
pub(super) struct Options {
#[command(subcommand)]
@@ -124,19 +124,7 @@ impl Options {
SC::Policy => {
let config: PolicyConfig = root.load_config()?;
info!("Loading and compiling the policy module");
let policy_file = tokio::fs::File::open(&config.wasm_module)
.await
.context("failed to open OPA WASM policy file")?;
let policy_factory = PolicyFactory::load(
policy_file,
config.data.clone().unwrap_or_default(),
config.register_entrypoint.clone(),
config.client_registration_entrypoint.clone(),
config.authorization_grant_entrypoint.clone(),
)
.await
.context("failed to load the policy")?;
let policy_factory = policy_factory_from_config(&config).await?;
let _instance = policy_factory.instantiate().await?;
Ok(())