From 9b72621135aad321c421e7464fc4339a2a52e245 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 1 Aug 2021 05:48:15 -0400 Subject: config defaults: cfte, config-file & cle --- src/doc_reform/spine.d | 73 +++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 60 insertions(+), 13 deletions(-) (limited to 'src/doc_reform/spine.d') diff --git a/src/doc_reform/spine.d b/src/doc_reform/spine.d index aff29b1..418177c 100755 --- a/src/doc_reform/spine.d +++ b/src/doc_reform/spine.d @@ -80,6 +80,7 @@ import doc_reform.io_in.read_source_files, doc_reform.io_out.hub; mixin(import("version.txt")); +mixin(import("configuration.txt")); mixin CompileTimeInfo; string project_name = "spine"; string program_name = "spine"; @@ -171,14 +172,22 @@ string program_name = "spine"; "workon" : false, ]; string[string] settings = [ - "cgi-search-title" : "", // config default: "spine-search" - "cgi-sqlite-search-filename" : "", // config default: "spine-search" + "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-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" "config" : "", - "output" : "", - "lang" : "all", // which language to process - "set-papersize" : "", // config default: a4 - "sqlite-db-filename" : "", // config default: "spine-search.db" - "webserv-domain" : "", // config default: localhost + "lang" : "all", //_cfg.default_language, // suggest "all" or "en" (default which language to process) + "set-papersize" : "", //_cfg.default_papersize, // suggest: a4 + "set-textwrap" : "", //_cfg.default_text_wrap, // suggest: 80 + "set-digest" : "", //_cfg.default_hash_digest, // suggest: sha256 + "sqlite-db-filename" : "", //_cfg.db_sqlite_filename, // suggest: "spine-search.db" ]; auto helpInfo = getopt(args, std.getopt.config.passThrough, @@ -186,6 +195,11 @@ string program_name = "spine"; "allow-downloads", "allow downloads (includes cgi.d from github)", &opts["allow-downloads"], "assert", "set optional assertions on", &opts["assertions"], "cgi-search-form-codegen", "generates (pre-compiled) d code for search of specified db", &opts["cgi-search-form-codegen"], + "cgi-bin-root", "path to cgi-bin directory", &settings["cgi-bin-root"], + "cgi-sqlite-search-filename", "cgi-bin sqlite search form name", &settings["cgi-sqlite-search-filename"], + "cgi-url-root", "url to cgi-bin (to find cgi-bin)", &settings["cgi-url-root"], + "cgi-url-action", "url to post to cgi-bin search form", &settings["cgi-url-action"], + "cgi-search-title", "title for cgi-bin search form", &settings["cgi-search-title"], "concordance", "file for document", &opts["concordance"], "dark", "alternative dark theme", &opts["dark"], "debug", "debug", &opts["debug"], @@ -228,6 +242,9 @@ string program_name = "spine"; "show-metadata", "show metadata", &opts["show-metadata"], "show-summary", "show summary", &opts["show-summary"], "source", "document markup source", &opts["source"], + "set-digest", "default hash digest type (e.g. sha256)", &settings["set-digest"], + "set-papersize", "default papersize (latex pdf eg. a4 or a5 or b4 or letter)", &settings["set-papersize"], + "set-textwrap", "default textwrap (e.g. 80 (characters)", &settings["set-textwrap"], "sqlite-discrete", "process discrete sqlite output", &opts["sqlite-discrete"], "sqlite-db-create", "create db, create tables", &opts["sqlite-db-create"], "sqlite-db-drop", "drop tables & db", &opts["sqlite-db-drop"], @@ -235,6 +252,10 @@ string program_name = "spine"; "sqlite-delete", "sqlite output", &opts["sqlite-delete"], "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-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"], "theme-light", "default light theme", &opts["theme-light"], @@ -248,9 +269,8 @@ string program_name = "spine"; "config", "=/path/to/config/file/including/filename", &settings["config"], "lang", "=[lang code e.g. =en or =en,es]", &settings["lang"], "output", "=/path/to/output/dir specify where to place output", &settings["output"], - "set-papersize", "=\"a4,a5,b4,letter\"", &settings["set-papersize"], - "sqlite-db-filename", "=[filename].sql.db", &settings["sqlite-db-filename"], - "webserv-domain", "=[web-server.domain.name]", &settings["webserv-domain"], + "sqlite-db-filename", "sqlite db to create, populate & make available for search", &settings["sqlite-db-filename"], + // "sqlite-db-filename", "=[filename].sql.db", &settings["sqlite-db-filename"], ); if (helpInfo.helpWanted) { defaultGetoptPrinter("Some information about the program.", helpInfo.options); @@ -361,6 +381,9 @@ string program_name = "spine"; @trusted bool source_or_pod() { return (opts["pod"] || opts["source"]) ? true : false; } + @trusted string sqlite_db_filename() { + return settings["sqlite-db-filename"]; + } @trusted bool sqlite_discrete() { return opts["sqlite-discrete"]; } @@ -436,6 +459,15 @@ string program_name = "spine"; @trusted string sqlite_filename() { return settings["sqlite-db-filename"]; } + @trusted string cgi_bin_root() { + return settings["cgi-bin-root"]; + } + @trusted string cgi_url_root() { + return settings["cgi-url-root"]; + } + @trusted string cgi_url_action() { + return settings["cgi-url-action"]; + } @trusted string cgi_search_title() { return settings["cgi-search-title"]; } @@ -447,11 +479,26 @@ string program_name = "spine"; ? (settings["cgi-sqlite-search-filename"].translate(['-' : "_"]) ~ ".d") : ""; } + @trusted string hash_digest_type() { + return settings["set-digest"]; + } + @trusted string text_wrap() { + return settings["set-textwrap"]; + } @trusted string latex_papersize() { return settings["set-papersize"]; } @trusted string webserver_domain_name() { - return settings["webserv-domain"]; + return settings["www-domain"]; + } + @trusted string webserver_domain_doc_root() { + return settings["www-domain-doc-root"]; + } + @trusted string webserver_url_doc_root() { + return settings["www-url-root"]; + } + @trusted string webserver_http() { + return settings["www-http"]; } @trusted bool parallelise() { bool _is; @@ -609,7 +656,7 @@ string program_name = "spine"; _manifested = PathMatters!()(_opt_action, _env, arg); { /+ local site config +/ _conf_file_details = configFilePaths!()(_manifested, _env, _opt_action.config_path_set); - auto _config_local_site_struct = readConfigSite!()(_conf_file_details, _opt_action); + auto _config_local_site_struct = readConfigSite!()(_conf_file_details, _opt_action, _cfg); import doc_reform.meta.conf_make_meta_yaml; _config = _config_local_site_struct.configParseYAMLreturnSpineStruct!()(_config, _manifested, _opt_action); // - get local site config break; @@ -617,7 +664,7 @@ string program_name = "spine"; } } } else { /+ local site config +/ - auto _config_local_site_struct = readConfigSite!()(_conf_file_details, _opt_action); + auto _config_local_site_struct = readConfigSite!()(_conf_file_details, _opt_action, _cfg); import doc_reform.meta.conf_make_meta_yaml; _config = _config_local_site_struct.configParseYAMLreturnSpineStruct!()(_config, _manifested, _opt_action); // - get local site config } -- cgit v1.2.3