From 02d4783f40ac59a684fc605cd5b9ff6ab144ec21 Mon Sep 17 00:00:00 2001 From: Javier Sagredo Date: Thu, 28 May 2026 02:13:38 +0200 Subject: [PATCH] Move to config --- config.pl | 6 ++++++ main.pl | 9 ++------- 2 files changed, 8 insertions(+), 7 deletions(-) create mode 100644 config.pl diff --git a/config.pl b/config.pl new file mode 100644 index 0000000..e5837b4 --- /dev/null +++ b/config.pl @@ -0,0 +1,6 @@ +:- module(config, [cert/1, addr/1, port/1, site/1]). + +cert("identity.p12"). +addr('127.0.0.1'). +port(1965). +site("./site"). diff --git a/main.pl b/main.pl index 9bddfb9..2315579 100644 --- a/main.pl +++ b/main.pl @@ -12,15 +12,10 @@ :- use_module('./request'). :- use_module('./response'). :- use_module('./log'). +:- use_module('./config'). % ------------------------------------------------------------------------------ - -cert("identity.p12"). -addr('127.0.0.1'). -port(1965). -site("./site"). - load_certificate(Context) :- cert(Cert), log_msg("tls", "Loading certificate from ~s~n", [Cert]), @@ -63,7 +58,7 @@ with_tls_connection(S0, Context, Kont) :- req_serve(S) :- read_request(S, RequestChars), log_msg("request", "Received raw request: ~s", [RequestChars]), - phrase(request(uri(H, P, Path, Query)), RequestChars), + phrase(request(uri(_, _, Path, Query)), RequestChars), ( serve(S, Path, Query) ; log_msg("error", "File not found~n", []), phrase(response(not_found, "File not found, sorry"), Response0), -- 2.54.0