commit 1c0d2d4c00c208a222fe231889311587bd0124a5
parent f6cdd0fbb64d6837c460602be475d84a2459c3b8
Author: Martin Schanzenbach <schanzen@gnunet.org>
Date: Wed, 13 Dec 2023 22:03:13 +0100
Update readme and configs
Diffstat:
3 files changed, 51 insertions(+), 39 deletions(-)
diff --git a/README.md b/README.md
@@ -10,23 +10,31 @@ $ go build ./cmd/gns-registrar
Edit the file ```gns-registrar.conf``` to fit your needs:
- * ```base_url```: The base URL your service is reachable under. (Default: ```"http://localhost:11000"```)
- * ```base_url_gnunet```: The base URL your GNUnet REST service is reachable under. (Default: ```"http://localhost:7776"```)
- * ```basic_auth_gnunet_enabled```: Does the GNUnet REST service require authentication. (Default: ```true```)
- * ```basic_auth_gnunet_username```: Basic authentication username for GNUnet REST service. (Default: ```"jdoe"```)
- * ```basic_auth_gnunet_password```: Basic authentication password for GNUnet REST service. (Default: ```"secret"```)
- * ```base_url_merchant```: The Taler merchant REST API base URL. (Default: ```"https://backend.demo.taler.net"```)
- * ```merchant_token```: The Taler merchant REST API authentication token. (Default: ```sandbox```)
- * ```bind_to```: The IP:PORT to bind to. (Default: ```"localhost:11000"```)
- * ```registrar_landing```: The landing page template file. (Default: ```"web/templates/landing.html"```)
- * ```registrar_name```: The name information page template file. (Default: ```"web/templates/name.html"```)
- * ```root_zone_name```: The GNS zone name to use. (Default: ```"test"```)
- * ```suffix_hint```: The self-advertised suffix for the zone. (Default: ```"example.alt"```)
- * ```payment_required_expiration```: The time the user is given to complete the payment for a registration. (Default: ```"1h"```)
- * ```relative_delegation_expiration```: For how long a name registration record is valid/cached in GNS. (Default: ```"24h"```)
- * ```registration_expiration```: For how long a name can be registered. (Default: ```"120h"```)
- * ```registration_cost```: The cost to register a name for the duration of ```registration_expiration```. (Default: ```"KUDOS:0.3"```)
- * ```order_summary_template```: Template for the order summary displayed to the user. May contain the placeholder ```${NAME}``` for the registered name. (Default: ```"Registration of `${NAME}' at GNUnet FCFS registrar"```)
+```
+[gns-registrar]
+production = false # Set if this is a production deployment. Currently unused.
+base_url = http://localhost:11000 # The base URL your service is reachable under.
+base_url_gnunet = http://localhost:7776 # The base URL your GNUnet REST service is reachable under.
+basic_auth_gnunet_enabled = true # Does the GNUnet REST service require authentication.
+basic_auth_gnunet_username = jdoe # Basic authentication username for GNUnet REST service.
+basic_auth_gnunet_password = secret # Basic authentication password for GNUnet REST service.
+base_url_merchant = https://backend.demo.taler.net # The Taler merchant REST API base URL.
+merchant_token = sandbox # The Taler merchant REST API authentication token.
+bind_to = localhost:11000 # The IP:PORT to bind to.
+landing_template = web/templates/landing.html # The landing page template file.
+name_template = web/templates/name.html # The name information page template file.
+edit_template = web/templates/edit.html # The registration management template file.
+buy_template = web/templates/buy.html # The checkout page template file.
+suffix_hint = example.alt # The self-advertised suffix for the zone.
+payment_required_expiration = 1h # The time the user is given to complete the payment for a registration.
+relative_delegation_expiration = 24h # For how long a name registration record is valid/cached in GNS.
+registration_duration_days = 5 # For how many days is a name registered (or a registration extended).
+registration_cost = KUDOS:0.3 # The cost to register a name for the duration of ```registration_expiration```.
+order_summary_template = "Registration of `${NAME}' at GNUnet FCFS registrar" # Template for the order summary displayed to the user. May contain the placeholder ```${NAME}``` for the registered name.
+root_zone_name = test # The GNS zone name to use.
+valid_label_regex = "" # The regex to check to verify the validity of a name. Ignored if set to ```""```.
+valid_label_script = "" # The script to use to check to verify the validity of a name. Script will be executed with the label as the first command line parameter. Ignored if set to ```""```.
+```
Make sure your GNUnet node is running, including the rest service.
Configure the GNUnet rest service base URL and authentication.
diff --git a/gns-registrar.conf.example b/gns-registrar.conf.example
@@ -1,21 +1,23 @@
[gns-registrar]
-production = false
-base_url = "http://localhost:11000"
-base_url_gnunet = "http://localhost:7776"
-basic_auth_gnunet_enabled = true
-basic_auth_gnunet_username = "jdoe"
-basic_auth_gnunet_password = "01KYT94APDV14"
-base_url_merchant = https://backend.demo.taler.net
-merchant_token = sandbox
-bind_to = "localhost:11000"
-delegations_public = no
-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
-registrar_landing = web/templates/landing.html
-registrar_name = web/templates/name.html
-registration_failed = templates/registration_failed.html
-root_zone_name = test
-suffix_hint = gnunet.gns.alt
+production = false # Set if this is a production deployment. Currently unused.
+base_url = http://localhost:11000 # The base URL your service is reachable under.
+base_url_gnunet = http://localhost:7776 # The base URL your GNUnet REST service is reachable under.
+basic_auth_gnunet_enabled = true # Does the GNUnet REST service require authentication.
+basic_auth_gnunet_username = jdoe # Basic authentication username for GNUnet REST service.
+basic_auth_gnunet_password = secret # Basic authentication password for GNUnet REST service.
+base_url_merchant = https://backend.demo.taler.net # The Taler merchant REST API base URL.
+merchant_token = sandbox # The Taler merchant REST API authentication token.
+bind_to = localhost:11000 # The IP:PORT to bind to.
+landing_template = web/templates/landing.html # The landing page template file.
+name_template = web/templates/name.html # The name information page template file.
+edit_template = web/templates/edit.html # The registration management template file.
+buy_template = web/templates/buy.html # The checkout page template file.
+suffix_hint = example.alt # The self-advertised suffix for the zone.
+payment_required_expiration = 1h # The time the user is given to complete the payment for a registration.
+relative_delegation_expiration = 24h # For how long a name registration record is valid/cached in GNS.
+registration_duration_days = 5 # For how many days is a name registered (or a registration extended).
+registration_cost = KUDOS:0.3 # The cost to register a name for the duration of ```registration_expiration```.
+order_summary_template = "Registration of `${NAME}' at GNUnet FCFS registrar" # Template for the order summary displayed to the user. May contain the placeholder ```${NAME}``` for the registered name.
+root_zone_name = test # The GNS zone name to use.
+valid_label_regex = "" # The regex to check to verify the validity of a name. Ignored if set to ```""```.
+valid_label_script = "" # The script to use to check to verify the validity of a name. Script will be executed with the label as the first command line parameter. Ignored if set to ```""```.
+\ No newline at end of file
diff --git a/pkg/rest/gnsregistrar.go b/pkg/rest/gnsregistrar.go
@@ -773,16 +773,17 @@ func (t *Registrar) Initialize(cfgfile string) {
fmt.Printf("Failed to read config: %v", err)
os.Exit(1)
}
+ _cfg.WriteTo(os.Stdout)
t.Cfg = _cfg
if t.Cfg.Section("gns-registrar").Key("production").MustBool(false) {
fmt.Println("Production mode enabled")
}
- landingTplFile := t.Cfg.Section("gns-registrar").Key("registrar_landing").MustString("web/templates/landing.html")
+ landingTplFile := t.Cfg.Section("gns-registrar").Key("landing_template").MustString("web/templates/landing.html")
t.LandingTpl, err = template.ParseFiles(landingTplFile)
if err != nil {
fmt.Println(err)
}
- nameTplFile := t.Cfg.Section("gns-registrar").Key("registrar_name").MustString("web/templates/name.html")
+ nameTplFile := t.Cfg.Section("gns-registrar").Key("name_template").MustString("web/templates/name.html")
t.NameTpl, err = template.ParseFiles(nameTplFile)
if err != nil {
fmt.Println(err)