commit e93f49639c6229d5f2dbbdabb05e5301f0b9b82e
parent da524311dcb265950ce4c36e35027fe8a223c3ad
Author: Antoine A <>
Date: Wed, 29 Jan 2025 13:21:34 +0100
magnet-bank: finish renaming
Diffstat:
8 files changed, 67 insertions(+), 67 deletions(-)
diff --git a/Cargo.lock b/Cargo.lock
@@ -1484,37 +1484,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04cbf5b083de1c7e0222a7a51dbfdba1cbe1c6ab0b15e29fff3f6c077fd9cd9f"
[[package]]
-name = "magnet-bank"
-version = "0.1.0"
-dependencies = [
- "anyhow",
- "base64",
- "clap",
- "form_urlencoded",
- "hmac",
- "jiff",
- "p256",
- "passterm",
- "percent-encoding",
- "rand_core 0.6.4",
- "reqwest",
- "serde",
- "serde_json",
- "serde_path_to_error",
- "serde_urlencoded",
- "sha1",
- "spki",
- "sqlx",
- "taler-api",
- "taler-common",
- "taler-test-utils",
- "thiserror",
- "tokio",
- "tracing",
- "tracing-subscriber",
-]
-
-[[package]]
name = "matchers"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2624,6 +2593,37 @@ dependencies = [
]
[[package]]
+name = "taler-magnet-bank-adapter"
+version = "0.1.0"
+dependencies = [
+ "anyhow",
+ "base64",
+ "clap",
+ "form_urlencoded",
+ "hmac",
+ "jiff",
+ "p256",
+ "passterm",
+ "percent-encoding",
+ "rand_core 0.6.4",
+ "reqwest",
+ "serde",
+ "serde_json",
+ "serde_path_to_error",
+ "serde_urlencoded",
+ "sha1",
+ "spki",
+ "sqlx",
+ "taler-api",
+ "taler-common",
+ "taler-test-utils",
+ "thiserror",
+ "tokio",
+ "tracing",
+ "tracing-subscriber",
+]
+
+[[package]]
name = "taler-test-utils"
version = "0.1.0"
dependencies = [
diff --git a/adapter/taler-magnet-bank-adapter/Cargo.toml b/adapter/taler-magnet-bank-adapter/Cargo.toml
@@ -1,5 +1,5 @@
[package]
-name = "magnet-bank"
+name = "taler-magnet-bank-adapter"
version = "0.1.0"
edition = "2021"
diff --git a/adapter/taler-magnet-bank-adapter/src/config.rs b/adapter/taler-magnet-bank-adapter/src/config.rs
@@ -30,7 +30,7 @@ pub struct DbConfig {
impl DbConfig {
pub fn parse(cfg: &Config) -> Result<Self, ValueErr> {
- let sect = cfg.section("magnet-bank-postgres");
+ let sect = cfg.section("taler-magnet-bank-adapter-postgres");
Ok(Self {
cfg: sect.postgres("CONFIG").require()?,
})
@@ -44,7 +44,7 @@ pub struct WireGatewayConfig {
impl WireGatewayConfig {
pub fn parse(cfg: &Config) -> Result<Self, ValueErr> {
- let sect = cfg.section("magnet-bank");
+ let sect = cfg.section("taler-magnet-bank-adapter");
let serve = map_config!(sect, "serve", "SERVE",
"tcp" => {
@@ -88,7 +88,7 @@ pub struct MagnetConfig {
impl MagnetConfig {
pub fn parse(cfg: &Config) -> Result<Self, ValueErr> {
- let sect = cfg.section("magnet-bank");
+ let sect = cfg.section("taler-magnet-bank-adapter");
Ok(Self {
api_url: sect.parse("URL", "API_URL").require()?,
consumer: Token {
diff --git a/adapter/taler-magnet-bank-adapter/src/keys.rs b/adapter/taler-magnet-bank-adapter/src/keys.rs
@@ -48,7 +48,7 @@ pub fn load(cfg: &MagnetConfig) -> anyhow::Result<Keys> {
};
fn incomplete_err() -> anyhow::Error {
- anyhow::anyhow!("Missing magnet keys, run 'magnet-bank setup' first")
+ anyhow::anyhow!("Missing magnet keys, run 'taler-magnet-bank-adapter setup' first")
}
// Check full
diff --git a/adapter/taler-magnet-bank-adapter/src/main.rs b/adapter/taler-magnet-bank-adapter/src/main.rs
@@ -17,7 +17,7 @@
use std::sync::Arc;
use clap::Parser;
-use magnet_bank::{
+use taler_magnet_bank_adapter::{
adapter::MagnetAdapter,
config::{DbConfig, MagnetConfig, WireGatewayConfig},
db,
@@ -49,19 +49,19 @@ struct Args {
#[derive(clap::Subcommand, Debug)]
enum Command {
- /// Setup magnet-bank auth token and account settings for Wire Gateway use
+ /// Setup taler-magnet-bank-adapter auth token and account settings for Wire Gateway use
Setup {
#[clap(long, short)]
reset: bool,
},
- /// Initialize magnet-bank database
+ /// Initialize taler-magnet-bank-adapter database
Dbinit {
#[clap(long, short)]
reset: bool,
},
- /// Run magnet-bank HTTP server
+ /// Run taler-magnet-bank-adapter HTTP server
Serve,
- /// Run magnet-bank worker
+ /// Run taler-magnet-bank-adapter worker
Worker {
// TODO account in config
account: Payto,
@@ -124,7 +124,7 @@ async fn app(args: Args, cfg: Config) -> anyhow::Result<()> {
fn main() {
let args = Args::parse();
taler_main(
- ConfigSource::new("magnet-bank", "magnet-bank", "magnet-bank"),
+ ConfigSource::new("taler-magnet-bank-adapter", "taler-magnet-bank-adapter", "taler-magnet-bank-adapter"),
args.common.clone(),
|cfg| async move { app(args, cfg).await },
);
diff --git a/adapter/taler-magnet-bank-adapter/tests/api.rs b/adapter/taler-magnet-bank-adapter/tests/api.rs
@@ -16,7 +16,6 @@
use std::sync::Arc;
-use magnet_bank::{adapter::MagnetAdapter, db, MagnetPayto};
use sqlx::PgPool;
use taler_api::{api::TalerApi, auth::AuthMethod, subject::OutgoingSubject};
use taler_common::{
@@ -24,6 +23,7 @@ use taler_common::{
api_wire::{OutgoingHistory, TransferState},
types::{amount::amount, payto::payto, timestamp::Timestamp, url},
};
+use taler_magnet_bank_adapter::{adapter::MagnetAdapter, db, MagnetPayto};
use taler_test_utils::{
axum_test::TestServer,
db_test_setup,
diff --git a/magnet-bank.conf b/magnet-bank.conf
@@ -1,23 +0,0 @@
-[magnet-bank]
-API_URL = "https://mobil.magnetbank.hu"
-CONSUMER_KEY = "Consumer"
-CONSUMER_SECRET = "qikgjxc5y06tiil7qgrmh09l7rfi5a8e"
-KEYS_FILE = keys.json
-
-# How "magnet-bank serve" serves its API, this can either be tcp or unix
-SERVE = tcp
-
-# Port on which the HTTP server listens, e.g. 9967. Only used if SERVE is tcp.
-PORT = 8080
-
-# Which IP address should we bind to? E.g. ``127.0.0.1`` or ``::1``for loopback. Only used if SERVE is tcp.
-BIND_TO = 0.0.0.0
-
-# Which unix domain path should we bind to? Only used if SERVE is unix.
-# UNIXPATH = libeufin-bank.sock
-
-# What should be the file access permissions for UNIXPATH? Only used if SERVE is unix.
-# UNIXPATH_MODE = 660
-
-[magnet-bank-postgres]
-CONFIG = postgres:/magnet-bank
-\ No newline at end of file
diff --git a/taler-magnet-bank-adapter.conf b/taler-magnet-bank-adapter.conf
@@ -0,0 +1,23 @@
+[taler-magnet-bank-adapter]
+API_URL = "https://mobil.magnetbank.hu"
+CONSUMER_KEY = "Consumer"
+CONSUMER_SECRET = "qikgjxc5y06tiil7qgrmh09l7rfi5a8e"
+KEYS_FILE = keys.json
+
+# How "taler-magnet-bank-adapter serve" serves its API, this can either be tcp or unix
+SERVE = tcp
+
+# Port on which the HTTP server listens, e.g. 9967. Only used if SERVE is tcp.
+PORT = 8080
+
+# Which IP address should we bind to? E.g. ``127.0.0.1`` or ``::1``for loopback. Only used if SERVE is tcp.
+BIND_TO = 0.0.0.0
+
+# Which unix domain path should we bind to? Only used if SERVE is unix.
+# UNIXPATH = libeufin-bank.sock
+
+# What should be the file access permissions for UNIXPATH? Only used if SERVE is unix.
+# UNIXPATH_MODE = 660
+
+[taler-magnet-bank-adapter-postgres]
+CONFIG = postgres:/taler-magnet-bank-adapter
+\ No newline at end of file