diff options
author | Ralph Amissah <ralph.amissah@gmail.com> | 2021-08-01 05:48:15 -0400 |
---|---|---|
committer | Ralph Amissah <ralph.amissah@gmail.com> | 2021-08-06 13:09:08 -0400 |
commit | 9b72621135aad321c421e7464fc4339a2a52e245 (patch) | |
tree | de3696ebbe50b488e326db934da7951c0f60a87e /org/spine.org | |
parent | spine_search (diff) |
config defaults: cfte, config-file & cle
Diffstat (limited to 'org/spine.org')
-rw-r--r-- | org/spine.org | 113 |
1 files changed, 98 insertions, 15 deletions
diff --git a/org/spine.org b/org/spine.org index aa928b0..ad2cf86 100644 --- a/org/spine.org +++ b/org/spine.org @@ -19,8 +19,8 @@ [[./spine_info.org][spine_info.org]] [[./][org/]] [[./spine_build_scaffold.org][make/build]] VERSION -* 0. version.txt (set version) :version: -** 0. set program tangle +* 0. version.txt configuration.txt (set version & configuration) +** 0. set program version tangle SET :version: #+HEADER: :tangle "../views/version.txt" #+BEGIN_SRC txt @@ -29,6 +29,35 @@ <<spine_compiler_restrictions>> #+END_SRC +** 0. set configuration tangle SET :configuration: + +#+HEADER: :tangle "../views/configuration_suggested.txt" +#+BEGIN_SRC d +/+ obt - org-mode generated file +/ +struct Cfg { + string www_http = "http"; + string www_doc_root = "/srv/www/spine/static"; // "/var/www/html" + string www_domain = "localhost"; + string www_domain_doc_root = "localhost"; + string www_url_doc_root = "http://localhost"; + string cgi_bin_root = "/var/www/cgi/cgi-bin/"; // "/usr/lib/cgi-bin" + string cgi_bin_part = "cgi-bin"; + string cgi_filename = "spine_search"; // "spine-search" + string cgi_url_root = "http://localhost/cgi-bin"; + string cgi_port = ""; + string cgi_user = ""; + string cgi_url_action = "http://localhost/cgi-bin/spine_search"; + string cgi_title = "≅ SiSU Spine search"; + string db_sqlite_doc_root = "/srv/www/spine/static/sqlite/"; + string db_sqlite_filename = "spine.search.db"; + string default_language = "en"; + string default_papersize = "a4"; + string default_text_wrap = "80"; + string default_hash_digest = "sha256"; +} +enum _cfg = Cfg(); +#+END_SRC + ** program version struct #+NAME: spine_version_struct @@ -97,6 +126,7 @@ homepage "https://sisudoc.org" +/ <<imports_spine>> <<mixin_spine_version>> +<<mixin_spine_configuration>> <<mixin_pre_main>> string project_name = "spine"; string program_name = "spine"; @@ -313,6 +343,13 @@ keep up to date, configuration in mixin(import("version.txt")); #+END_SRC +***** configuration.txt :configuration: + +#+NAME: mixin_spine_configuration +#+BEGIN_SRC d +mixin(import("configuration.txt")); +#+END_SRC + ***** pre main mixins #+NAME: mixin_pre_main @@ -438,14 +475,22 @@ bool[string] opts = [ "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" ]; #+END_SRC @@ -459,6 +504,11 @@ auto helpInfo = getopt(args, "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"], @@ -501,6 +551,9 @@ auto helpInfo = getopt(args, "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"], @@ -508,6 +561,10 @@ auto helpInfo = getopt(args, "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"], @@ -521,9 +578,8 @@ auto helpInfo = getopt(args, "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); @@ -641,6 +697,9 @@ struct OptActions { @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"]; } @@ -716,6 +775,15 @@ struct OptActions { @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"]; } @@ -727,11 +795,26 @@ struct OptActions { ? (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; @@ -902,7 +985,7 @@ if ( _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; @@ -910,7 +993,7 @@ if ( } } } 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 } |