Skip to content

Commit

Permalink
taler-mailbox: init at 0-unstable-2022-07-20
Browse files Browse the repository at this point in the history
  • Loading branch information
eljamm authored and Atemu committed Jun 10, 2024
1 parent d53e3a1 commit 7ff4e70
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 0 deletions.
27 changes: 27 additions & 0 deletions pkgs/by-name/taler-mailbox/0001-Use-the-existing-mailbox.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Subject: [PATCH] Use the existing mailbox and don't create a new one

It's wrong to re-declare a new mailbox inside the main function
since a global one is already defined.

This is because if the global mailbox is not initialized, the
program will panic whenever we try to read a key from the config.
---
cmd/mailbox-server/main.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cmd/mailbox-server/main.go b/cmd/mailbox-server/main.go
index 070b7af..458c401 100644
--- a/cmd/mailbox-server/main.go
+++ b/cmd/mailbox-server/main.go
@@ -40,7 +40,7 @@ func main() {
if len(*cfgFlag) != 0 {
cfgfile = *cfgFlag
}
- m := mailbox.Mailbox{}
+ m = mailbox.Mailbox{}
m.Initialize(cfgfile)
handleRequests()
}
--
2.44.0

17 changes: 17 additions & 0 deletions pkgs/by-name/taler-mailbox/example.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[mailbox]
production = false
host = "https://taler-mailbox.gnunet.org"
bind_to = "localhost:11000"
message_fee = KUDOS:1
default_doc_filetype = text/html
default_doc_lang = en
default_tos_path = terms/
default_pp_path = privacy/
supported_doc_filetypes = text/html application/pdf application/epub application/xml text/plain

[mailbox-pq]
host = "localhost"
port = 5432
user = "taler-mailbox"
password = "secret"
db_name = "taler-mailbox"
38 changes: 38 additions & 0 deletions pkgs/by-name/taler-mailbox/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
lib,
buildGoModule,
fetchgit,
}:
buildGoModule {
pname = "taler-mailbox";
version = "0-unstable-2022-07-20";

src = fetchgit {
url = "https://git.taler.net/taler-mailbox.git";
rev = "ee5c19e9edf7e4e0959becc99e97606d9e6de041";
hash = "sha256-t5IE8CuAKT5qlCNIqG9m8Gw0zJHa7505wHNK2ENuRQU=";
};

vendorHash = "sha256-frrmhfCcbY5DpCxR2g6HeSfN7xuLxpAWRahQl140voI=";

patches = [
./0001-Use-the-existing-mailbox.patch
];

postInstall = ''
install ./configs/mailbox-example.conf -Dt $out/share/examples/taler-mailbox
'';

ldflags = [
"-s"
"-w"
];

meta = with lib; {
description = "Service for asynchronous wallet-to-wallet payment messages";
homepage = "https://git.taler.net/taler-mailbox.git";
license = licenses.agpl3Only;
maintainers = with maintainers; [];
mainProgram = "mailbox-server";
};
}

0 comments on commit 7ff4e70

Please sign in to comment.