From 24269204508d8cf8f963eb9c7d149d18840e4dad Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 12 Aug 2021 13:14:49 -0400 Subject: config, clean up and make a bit more consistent - check version settings with: rg -A2 _version_set$ org --- src/COPYRIGHT | 2 +- src/doc_reform/COPYRIGHT | 2 +- src/doc_reform/io_in/read_config_files.d | 91 ++++++++++++++-------------- src/doc_reform/meta/conf_make_meta_json.d | 2 +- src/doc_reform/meta/conf_make_meta_structs.d | 10 +-- src/doc_reform/meta/conf_make_meta_yaml.d | 45 +++++++------- src/doc_reform/meta/metadoc_show_config.d | 22 +++---- src/doc_reform/spine.d | 18 +++--- 8 files changed, 96 insertions(+), 96 deletions(-) (limited to 'src') diff --git a/src/COPYRIGHT b/src/COPYRIGHT index f4fe0b2..6995436 100644 --- a/src/COPYRIGHT +++ b/src/COPYRIGHT @@ -129,7 +129,7 @@ - Copyright: (C) 2008 - 2021 Adam D. Ruppe - - code: cgi.d (copy in ./misc/ext_lib/src/arsd/) + - code: cgi.d (copy in ./sundry/spine_search_cgi/src/ext_depends_cgi/arsd) aria2c https://raw.githubusercontent.com/adamdruppe/arsd/master/cgi.d - License: BSL-1.0 diff --git a/src/doc_reform/COPYRIGHT b/src/doc_reform/COPYRIGHT index f4fe0b2..6995436 100644 --- a/src/doc_reform/COPYRIGHT +++ b/src/doc_reform/COPYRIGHT @@ -129,7 +129,7 @@ - Copyright: (C) 2008 - 2021 Adam D. Ruppe - - code: cgi.d (copy in ./misc/ext_lib/src/arsd/) + - code: cgi.d (copy in ./sundry/spine_search_cgi/src/ext_depends_cgi/arsd) aria2c https://raw.githubusercontent.com/adamdruppe/arsd/master/cgi.d - License: BSL-1.0 diff --git a/src/doc_reform/io_in/read_config_files.d b/src/doc_reform/io_in/read_config_files.d index 037fa22..a3a5dd8 100644 --- a/src/doc_reform/io_in/read_config_files.d +++ b/src/doc_reform/io_in/read_config_files.d @@ -69,55 +69,56 @@ template readConfigSite() { string config_file_str; string default_config_file_str = format(q"┃ flag: - act0: "--html" - act1: "--html --epub" + act0: "--html" + act1: "--html --epub" output: - path: "%s" + path: "%s" default: - language: "en" - papersize: "a4" - text_wrap: "80" - digest: "sha256" + language: "en" + papersize: "a4" + text_wrap: "80" + digest: "sha256" webserv: - http: "%s" - domain: "%s" - data_http: "%s" - data_domain: "%s" - data_root_url: "%s" - data_root_path: "%s" - data_root_part: "" - images_root_part: "image" - cgi_title: "%s" - cgi_http: "%s" - cgi_domain: "%s" - cgi_bin_url: "%s" - cgi_bin_part: "cgi-bin" - cgi_bin_path: "%s" - cgi_search_script: "%s" - cgi_port: "" - cgi_user: "" - cgi_action: "%s" - db_sqlite_path: "%s" - db_sqlite_filename: "%s" - db_pg_table: "" - db_pg_user: "" + http: "%s" + host: "%s" + data_http: "%s" + data_host: "%s" + data_root_url: "%s" + data_root_path: "%s" + data_root_part: "" + images_root_part: "image" + cgi_search_form_title: "%s" + cgi_http: "%s" + cgi_host: "%s" + cgi_bin_url: "%s" + cgi_bin_subpath: "%s" + cgi_bin_path: "%s" + cgi_search_script: "%s" + cgi_port: "" + cgi_user: "" + cgi_action: "%s" + db_sqlite_path: "%s" + db_sqlite_filename: "%s" + db_pg_table: "" + db_pg_user: "" ┃", - _cfg.www_doc_root, // doc root - _cfg.www_http, // http - _cfg.www_domain, // domain - _cfg.www_http, // data http - _cfg.www_domain, // data domain - _cfg.www_url_doc_root, // data root url - _cfg.www_doc_root, // data root path - _cfg.cgi_title, // cgi title - _cfg.www_http, // cgi http - _cfg.www_domain, // cgi domain - _cfg.cgi_url_root, // cgi bin url - _cfg.cgi_bin_root, // cgi bin path - _cfg.cgi_filename, // cgi filename - _cfg.cgi_url_action, // cgi action - _cfg.db_sqlite_path, // sqlite db path - _cfg.db_sqlite_filename, // sqlite db filename + _cfg.www_doc_root, // doc root + _cfg.www_http, // http + _cfg.www_host, // host / domain + _cfg.www_http, // data http + _cfg.www_host, // data domain + _cfg.www_url_doc_root, // data root url + _cfg.www_doc_root, // data root path + _cfg.cgi_search_form_title, // cgi title + _cfg.www_http, // cgi http + _cfg.www_host, // cgi host + _cfg.cgi_url_root, // cgi bin url + _cfg.cgi_bin_subpath, // cgi bin path + _cfg.cgi_bin_root, // cgi bin path + _cfg.cgi_filename, // cgi filename + _cfg.cgi_url_action, // cgi action + _cfg.db_sqlite_path, // sqlite db path + _cfg.db_sqlite_filename, // sqlite db filename ); foreach(conf_fn; [_conf_file_details.config_filename_site]) { foreach(pth; _conf_file_details.possible_config_path_locations.config_local_site) { diff --git a/src/doc_reform/meta/conf_make_meta_json.d b/src/doc_reform/meta/conf_make_meta_json.d index 7c77f65..cc46754 100644 --- a/src/doc_reform/meta/conf_make_meta_json.d +++ b/src/doc_reform/meta/conf_make_meta_json.d @@ -254,7 +254,7 @@ static template contentJSONtoSpineStruct() { ) { _struct_composite.conf.w_srv_data_root_url = _json.object["webserv"]["data_root_url"].str; if (auto m = _struct_composite.conf.w_srv_data_root_url.match(rgx.webserv_data_root_url)) { - _struct_composite.conf.w_srv_url_domain = m.captures[2].to!string; + _struct_composite.conf.w_srv_url_host = m.captures[2].to!string; _struct_composite.conf.w_srv_url_doc_path = m.captures[3].to!string; } } diff --git a/src/doc_reform/meta/conf_make_meta_structs.d b/src/doc_reform/meta/conf_make_meta_structs.d index 2863f0d..aff2465 100644 --- a/src/doc_reform/meta/conf_make_meta_structs.d +++ b/src/doc_reform/meta/conf_make_meta_structs.d @@ -192,19 +192,19 @@ struct ConfCompositeMakeInit { } struct ConfCompositeSiteLocal { string w_srv_http; - string w_srv_domain; + string w_srv_host; string w_srv_data_http; // if not set same as webserv_http - string w_srv_data_domain; // if not set same as webserv_domain + string w_srv_data_host; // if not set same as webserv_host string w_srv_data_root_part; string w_srv_data_root_url; string w_srv_data_root_url_html; string w_srv_data_root_path; string w_srv_images_root_part; // string w_srv_url_doc_path; - string w_srv_cgi_title; + string w_srv_cgi_search_form_title; string w_srv_cgi_http; // if not set same as webserv_http - string w_srv_cgi_domain; // if not set same as webserv_domain - string w_srv_cgi_bin_part; + string w_srv_cgi_host; // if not set same as webserv_host + string w_srv_cgi_bin_subpath; string w_srv_cgi_bin_path; string w_srv_cgi_search_title; string w_srv_cgi_search_script; diff --git a/src/doc_reform/meta/conf_make_meta_yaml.d b/src/doc_reform/meta/conf_make_meta_yaml.d index 3780553..eac55b7 100644 --- a/src/doc_reform/meta/conf_make_meta_yaml.d +++ b/src/doc_reform/meta/conf_make_meta_yaml.d @@ -256,11 +256,11 @@ template contentYAMLtoSpineStruct() { ) { _struct_composite.conf.w_srv_cgi_http = _yaml["webserv"]["cgi_http"].get!string; } - if ("domain" in _yaml["webserv"] - && _yaml["webserv"]["domain"].type.string - && _yaml["webserv"]["domain"].tag.match(rgx.yaml_tag_is_str) + if ("host" in _yaml["webserv"] + && _yaml["webserv"]["host"].type.string + && _yaml["webserv"]["host"].tag.match(rgx.yaml_tag_is_str) ) { - _struct_composite.conf.w_srv_domain = _yaml["webserv"]["domain"].get!string; + _struct_composite.conf.w_srv_host = _yaml["webserv"]["host"].get!string; } // if ("data_root_url" in _yaml["webserv"] // && _yaml["webserv"]["data_root_url"].type.string @@ -268,7 +268,7 @@ template contentYAMLtoSpineStruct() { // ) { // _struct_composite.conf.w_srv_data_root_url = _yaml["webserv"]["data_root_url"].get!string; // if (auto m = _struct_composite.conf.w_srv_data_root_url.match(rgx.webserv_url_doc_root)) { - // _struct_composite.conf.w_srv_url_domain = m.captures[2].to!string; + // _struct_composite.conf.w_srv_url_host = m.captures[2].to!string; // _struct_composite.conf.w_srv_url_doc_path = m.captures[3].to!string; // } // } @@ -306,25 +306,25 @@ template contentYAMLtoSpineStruct() { ~ _manifested.src.language ~ "/" ~ "html"; } - if ("cgi_domain" in _yaml["webserv"] - && _yaml["webserv"]["cgi_domain"].type.string - && _yaml["webserv"]["cgi_domain"].tag.match(rgx.yaml_tag_is_str) + if ("cgi_host" in _yaml["webserv"] + && _yaml["webserv"]["cgi_host"].type.string + && _yaml["webserv"]["cgi_host"].tag.match(rgx.yaml_tag_is_str) ) { - _struct_composite.conf.w_srv_cgi_domain = _yaml["webserv"]["cgi_domain"].get!string; + _struct_composite.conf.w_srv_cgi_host = _yaml["webserv"]["cgi_host"].get!string; } else { // composite construct - _struct_composite.conf.w_srv_cgi_domain = _struct_composite.conf.w_srv_domain; + _struct_composite.conf.w_srv_cgi_host = _struct_composite.conf.w_srv_host; } - if ("cgi_title" in _yaml["webserv"] - && _yaml["webserv"]["cgi_title"].type.string - && _yaml["webserv"]["cgi_title"].tag.match(rgx.yaml_tag_is_str) + if ("cgi_search_form_title" in _yaml["webserv"] + && _yaml["webserv"]["cgi_search_form_title"].type.string + && _yaml["webserv"]["cgi_search_form_title"].tag.match(rgx.yaml_tag_is_str) ) { - _struct_composite.conf.w_srv_cgi_title = _yaml["webserv"]["cgi_title"].get!string; + _struct_composite.conf.w_srv_cgi_search_form_title = _yaml["webserv"]["cgi_search_form_title"].get!string; } - if ("cgi_bin_part" in _yaml["webserv"] - && _yaml["webserv"]["cgi_bin_part"].type.string - && _yaml["webserv"]["cgi_bin_part"].tag.match(rgx.yaml_tag_is_str) + if ("cgi_bin_subpath" in _yaml["webserv"] + && _yaml["webserv"]["cgi_bin_subpath"].type.string + && _yaml["webserv"]["cgi_bin_subpath"].tag.match(rgx.yaml_tag_is_str) ) { - _struct_composite.conf.w_srv_cgi_bin_part = _yaml["webserv"]["cgi_bin_part"].get!string; + _struct_composite.conf.w_srv_cgi_bin_subpath = _yaml["webserv"]["cgi_bin_subpath"].get!string; } if ("cgi_bin_path" in _yaml["webserv"] && _yaml["webserv"]["cgi_bin_path"].type.string @@ -390,11 +390,10 @@ template contentYAMLtoSpineStruct() { ? _struct_composite.conf.w_srv_http :_struct_composite.conf.w_srv_cgi_http ~ "://" - ~ (_struct_composite.conf.w_srv_cgi_domain.empty) - ? _struct_composite.conf.w_srv_cgi_domain - : _struct_composite.conf.w_srv_domain - ~ "/" - ~ _struct_composite.conf.w_srv_cgi_bin_part; + ~ (_struct_composite.conf.w_srv_cgi_host.empty) + ? _struct_composite.conf.w_srv_cgi_host + : _struct_composite.conf.w_srv_host + ~ _struct_composite.conf.w_srv_cgi_bin_subpath; } if (_opt_action.cgi_sqlite_search_filename.length > 0) { _struct_composite.conf.w_srv_cgi_action = _struct_composite.conf.w_srv_cgi_bin_url ~ "/" ~ _opt_action.cgi_sqlite_search_filename; diff --git a/src/doc_reform/meta/metadoc_show_config.d b/src/doc_reform/meta/metadoc_show_config.d index 20e796f..2b07c77 100644 --- a/src/doc_reform/meta/metadoc_show_config.d +++ b/src/doc_reform/meta/metadoc_show_config.d @@ -74,8 +74,8 @@ template spineShowSiteConfig() { writefln( "\n%s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n", markup.repeat_character_by_number_provided("-", char_repeat_number), - "- webserv domain name:", - config.conf.w_srv_domain, + "- webserv host name:", + config.conf.w_srv_host, "- webserv doc root (part):", config.conf.w_srv_data_root_part, "- webserv doc path:", @@ -84,12 +84,12 @@ template spineShowSiteConfig() { config.conf.w_srv_images_root_part, "- webserv doc root url:", config.conf.w_srv_data_root_url, - "- webserv cgi domain (host):", - config.conf.w_srv_cgi_domain, + "- webserv cgi host (host):", + config.conf.w_srv_cgi_host, "- webserv cgi host path:", config.conf.w_srv_cgi_bin_path, "- webserv cgi host (part):", - config.conf.w_srv_cgi_bin_part, + config.conf.w_srv_cgi_bin_subpath, "- webserv cgi search script:", config.conf.w_srv_cgi_search_script, "- webserv cgi search script in d:", @@ -103,7 +103,7 @@ template spineShowSiteConfig() { "- webserv cgi action:", config.conf.w_srv_cgi_action, "- webserv cgi title:", - config.conf.w_srv_cgi_title, + config.conf.w_srv_cgi_search_form_title, // "- webserv cgi file links:", // config.conf.w_srv_cgi_file_links, "- webserv sqlite db:", @@ -174,8 +174,8 @@ template spineShowConfig() { doc_matters.conf_make_meta.meta.creator_author, doc_matters.src.filename, markup.repeat_character_by_number_provided("-", char_repeat_number), - "- webserv domain name:", - doc_matters.conf_make_meta.conf.w_srv_domain, + "- webserv host name:", + doc_matters.conf_make_meta.conf.w_srv_host, "- webserv doc root (part):", doc_matters.conf_make_meta.conf.w_srv_data_root_part, "- webserv doc path:", @@ -184,12 +184,12 @@ template spineShowConfig() { doc_matters.conf_make_meta.conf.w_srv_images_root_part, "- webserv doc root url:", doc_matters.conf_make_meta.conf.w_srv_data_root_url, - "- webserv cgi domain (host):", - doc_matters.conf_make_meta.conf.w_srv_cgi_domain, + "- webserv cgi host (host):", + doc_matters.conf_make_meta.conf.w_srv_cgi_host, "- webserv cgi host path:", doc_matters.conf_make_meta.conf.w_srv_cgi_bin_path, "- webserv cgi host (part):", - doc_matters.conf_make_meta.conf.w_srv_cgi_bin_part, + doc_matters.conf_make_meta.conf.w_srv_cgi_bin_subpath, "- webserv cgi search script:", doc_matters.conf_make_meta.conf.w_srv_cgi_search_script, "- webserv cgi search script in d:", diff --git a/src/doc_reform/spine.d b/src/doc_reform/spine.d index d7d175e..752d3ee 100755 --- a/src/doc_reform/spine.d +++ b/src/doc_reform/spine.d @@ -174,14 +174,14 @@ string program_name = "spine"; string[string] settings = [ "output" : "", //_cfg.www_doc_root, // "/srv/www/spine/static" or "/var/www/html" "www-http" : "", //_cfg.www_http, // "http" or "https" - "www-domain" : "", //_cfg.www_domain, // start with "localhost" ? - "www-domain-doc-root" : "", //_cfg.www_domain_doc_root, // start with "localhost" ? + "www-host" : "", //_cfg.www_host, // start with "localhost" ? + "www-host-doc-root" : "", //_cfg.www_host_doc_root, // start with "localhost" ? "www-url-doc-root" : "", //_cfg.www_url_doc_root, // start with "http://localhost" ? "cgi-bin-root" : "", //_cfg.cgi_bin_root, // suggest "/var/www/cgi/cgi-bin" "cgi-sqlite-search-filename" : "", //_cfg.cgi_filename, // suggest "spine_search" (though "spine-search" would have been preferable?) "cgi-url-root" : "", //_cfg.cgi_url_root, // start with "http://localhost/cgi-bin" ? "cgi-url-action" : "", //_cfg.cgi_url_action, // start with "http://localhost/cgi-bin/spine-search" - "cgi-search-title" : "", //_cfg.cgi_title, // e.g. "≅ SiSU Spine search" + "cgi-search-title" : "", //_cfg.cgi_search_form_title, // e.g. "≅ SiSU Spine search" "config" : "", "lang" : "all", //_cfg.default_language, // suggest "all" or "en" (default which language to process) "set-papersize" : "", //_cfg.default_papersize, // suggest: a4 @@ -254,8 +254,8 @@ string program_name = "spine"; "sqlite-insert", "sqlite output", &opts["sqlite-insert"], "sqlite-update", "sqlite output", &opts["sqlite-update"], "www-http", "http or https", &settings["www-http"], - "www-domain", "web server domain name", &settings["www-domain"], - "www-domain-doc-root", "web host domain name with path to doc root", &settings["www-domain-doc-root"], + "www-host", "web server host (domain) name", &settings["www-host"], + "www-host-doc-root", "web host host (domain) name with path to doc root", &settings["www-host-doc-root"], "www-url-doc-root", "e.g. http://localhost", &settings["www-url-doc-root"], "text", "text output", &opts["text"], "theme-dark", "alternative dark theme", &opts["theme-dark"], @@ -496,11 +496,11 @@ string program_name = "spine"; @trusted string latex_papersize() { return settings["set-papersize"]; } - @trusted string webserver_domain_name() { - return settings["www-domain"]; + @trusted string webserver_host_name() { + return settings["www-host"]; } - @trusted string webserver_domain_doc_root() { - return settings["www-domain-doc-root"]; + @trusted string webserver_host_doc_root() { + return settings["www-host-doc-root"]; } @trusted string webserver_url_doc_root() { return settings["www-url-root"]; -- cgit v1.2.3