[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-exchange] branch master updated: include shard domain and remote
From: |
gnunet |
Subject: |
[taler-exchange] branch master updated: include shard domain and remote users in taler config |
Date: |
Mon, 02 May 2022 00:28:40 +0200 |
This is an automated email from the git hooks/post-receive script.
marco-boss pushed a commit to branch master
in repository exchange.
The following commit(s) were added to refs/heads/master by this push:
new 72ae759f include shard domain and remote users in taler config
72ae759f is described below
commit 72ae759fa0e31766855dd30b6783f1f14c942e39
Author: Marco Boss <bossm8@bfh.ch>
AuthorDate: Mon May 2 00:27:59 2022 +0200
include shard domain and remote users in taler config
---
src/exchangedb/common-0001.sql | 10 +++--
src/exchangedb/plugin_exchangedb_postgres.c | 64 ++++++++++++++++++++++++++---
2 files changed, 65 insertions(+), 9 deletions(-)
diff --git a/src/exchangedb/common-0001.sql b/src/exchangedb/common-0001.sql
index a96b91fa..6d45c22e 100644
--- a/src/exchangedb/common-0001.sql
+++ b/src/exchangedb/common-0001.sql
@@ -2627,7 +2627,9 @@ COMMENT ON FUNCTION create_shard_server
CREATE OR REPLACE FUNCTION create_foreign_servers(
amount INTEGER
- ,domain VARCHAR DEFAULT 'perf.taler'
+ ,domain VARCHAR
+ ,remote_user VARCHAR DEFAULT 'taler'
+ ,remote_user_password VARCHAR DEFAULT 'taler'
)
RETURNS VOID
LANGUAGE plpgsql
@@ -2642,14 +2644,16 @@ BEGIN
,amount
,i
,'shard-' || i::varchar || '.' || domain
- ,'taler'
- ,'taler'
+ ,remote_user
+ ,remote_user_password
,'taler-exchange'
,'5432'
,'taler-exchange-httpd'
);
END LOOP;
+ PERFORM drop_default_partitions();
+
END
$$;
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c
b/src/exchangedb/plugin_exchangedb_postgres.c
index 8d29581d..c5833d43 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -356,16 +356,61 @@ postgres_setup_foreign_servers (void *cls,
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_Context *conn;
enum GNUNET_GenericReturnValue ret = GNUNET_OK;
+ char *shard_domain = NULL;
+ char *remote_user = NULL;
+ char *remote_user_pw = NULL;
+
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_string (pg->cfg,
+ "exchange",
+ "SHARD_DOMAIN",
+ &shard_domain))
+ {
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ "exchange",
+ "SHARD_DOMAIN");
+ return GNUNET_SYSERR;
+ }
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_string (pg->cfg,
+ "exchangedb-postgres",
+ "SHARD_REMOTE_USER",
+ &remote_user))
+ {
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ "exchangedb-postgres",
+ "SHARD_REMOTE_USER");
+ GNUNET_free (shard_domain);
+ return GNUNET_SYSERR;
+ }
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_string (pg->cfg,
+ "exchangedb-postgres",
+ "SHARD_REMOTE_USER_PW",
+ &remote_user_pw))
+ {
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ "exchangedb-postgres",
+ "SHARD_REMOTE_USER_PW");
+ GNUNET_free (shard_domain);
+ GNUNET_free (remote_user);
+ return GNUNET_SYSERR;
+ }
+
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint32 (&num),
+ GNUNET_PQ_query_param_string (shard_domain),
+ GNUNET_PQ_query_param_string (remote_user),
+ GNUNET_PQ_query_param_string (remote_user_pw),
GNUNET_PQ_query_param_end
};
+
struct GNUNET_PQ_PreparedStatement ps[] = {
GNUNET_PQ_make_prepare ("create_foreign_servers",
"SELECT"
" create_foreign_servers"
- " ($1);",
- 1),
+ " ($1, $2, $3, $4);",
+ 4),
GNUNET_PQ_PREPARED_STATEMENT_END
};
@@ -375,11 +420,18 @@ postgres_setup_foreign_servers (void *cls,
NULL,
ps);
if (NULL == conn)
- return GNUNET_SYSERR;
- if (0 > GNUNET_PQ_eval_prepared_non_select (conn,
- "create_foreign_servers",
- params))
+ {
ret = GNUNET_SYSERR;
+ }
+ else if (0 > GNUNET_PQ_eval_prepared_non_select (conn,
+ "create_foreign_servers",
+ params))
+ {
+ ret = GNUNET_SYSERR;
+ }
+ GNUNET_free (shard_domain);
+ GNUNET_free (remote_user);
+ GNUNET_free (remote_user_pw);
GNUNET_PQ_disconnect (conn);
return ret;
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-exchange] branch master updated: include shard domain and remote users in taler config,
gnunet <=