From e37589f5f5253d81c62f8846dbf721c23fe48d44 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 7 Oct 2021 20:39:57 -0400 Subject: configuration, hierarchy filenames & paths ... --- org/spine.org | 102 ++++++++++++++++++++++++---------------------------------- 1 file changed, 42 insertions(+), 60 deletions(-) (limited to 'org/spine.org') diff --git a/org/spine.org b/org/spine.org index 805524d..fa246b9 100644 --- a/org/spine.org +++ b/org/spine.org @@ -393,48 +393,30 @@ bool[string] opts = [ ***** initialize settings -NOTES on configuration hierarchy: -- compile time program defaults views/configuration.txt in config_d_cfte.org - - config_d_cfte.org (writes views/configuration.txt) - - compile time program defaults, set in views/configuration.txt - - found in: _cfg.* -- run time default configuration administrators config ".dr/config_site_local" - - in_source_files.org readConfigSite (reads administrators site defaults from - yaml config file) - - meta_conf_make_meta.org struct ConfCompositeSiteLocal - - administrator site defaults read from yaml configuration file - ".dr/config_site_local" - - found in: "doc_matters.conf_make_meta.conf." (incorporates _cfg.* as - initial default values that are overridden if set) - - ("conf_make_meta.make" (& "conf_make_meta.meta") also available taken from - document headers) -- command line execution configuration instruction - - spine.org (org heading: initialize settings) (command line overrides) - - command line settings/overrides - - found in: doc_matters.opt.action.* +NOTES on configuration hierarchy: see meta_conf_make_meta.org #+NAME: spine_args_init_settings #+BEGIN_SRC d 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-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-http" : "", //_cfg.cgi_http, // suggest - "cgi-host" : "", //_cfg.cgi_host, // suggest - "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_search_form_title, // e.g. "≅ SiSU Spine search" + "output" : "", + "www-http" : "", + "www-host" : "", + "www-host-doc-root" : "", + "www-url-doc-root" : "", + "cgi-http" : "", + "cgi-host" : "", + "cgi-bin-root" : "", + "cgi-sqlite-search-filename" : "", + "cgi-url-root" : "", + "cgi-url-action" : "", + "cgi-search-title" : "", "config" : "", - "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-path" : "", //_cfg.db_sqlite_path, // suggest: "/var/www/sqlite" - "sqlite-db-filename" : "", //_cfg.db_sqlite_filename, // suggest: "spine-search.db" + "lang" : "all", + "set-papersize" : "", + "set-textwrap" : "", + "set-digest" : "", + "sqlite-db-path" : "", + "sqlite-db-filename" : "", ]; #+END_SRC @@ -449,10 +431,10 @@ auto helpInfo = getopt(args, "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"], + "cgi-search-title", "if generating a cgi search form the title to use for it", &settings["cgi-search-title"], + "cgi-sqlite-search-filename", "=[filename] default is spine-search", &settings["cgi-sqlite-search-filename"], "concordance", "file for document", &opts["concordance"], "curate", "extract info on authors & topics from document header metadata", &opts["curate"], "curate-authors", "extract info on authors from document header metadata", &opts["curate-authors"], @@ -467,6 +449,7 @@ auto helpInfo = getopt(args, "html-link-search", "html embedded search submission", &opts["html-link-search"], "html-seg", "process html output", &opts["html-seg"], "html-scroll", "process html output", &opts["html-scroll"], + "lang", "=[lang code e.g. =en or =en,es]", &settings["lang"], "latex", "output for pdfs", &opts["latex"], "latex-color-links", "mono or color links for pdfs", &opts["latex-color-links"], "light", "default light theme", &opts["light"], @@ -474,6 +457,7 @@ auto helpInfo = getopt(args, "ocn-off", "object cite numbers", &opts["ocn-off"], "odf", "open document format text (--odt)", &opts["odf"], "odt", "open document format text", &opts["odt"], + "output", "=/path/to/output/dir specify where to place output", &settings["output"], "parallel", "parallelisation", &opts["parallel"], "parallel-subprocesses", "nested parallelisation", &opts["parallel-subprocesses"], "pdf", "latex output for pdfs", &opts["pdf"], @@ -501,6 +485,8 @@ auto helpInfo = getopt(args, "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"], + "sqlite-db-filename", "sqlite db to create, populate & make available for search", &settings["sqlite-db-filename"], + "sqlite-db-path", "sqlite db path", &settings["sqlite-db-path"], "sqlite-db-recreate", "create db, create tables", &opts["sqlite-db-recreate"], "sqlite-delete", "sqlite output", &opts["sqlite-delete"], "sqlite-insert", "sqlite output", &opts["sqlite-insert"], @@ -517,13 +503,7 @@ auto helpInfo = getopt(args, "very-verbose", "output to terminal", &opts["very-verbose"], "workon", "(reserved for some matters under development & testing)", &opts["workon"], "xhtml", "xhtml output", &opts["xhtml"], - "cgi-search-title", "if generating a cgi search form the title to use for it", &settings["cgi-search-title"], - "cgi-sqlite-search-filename", "=[filename] default is spine-search", &settings["cgi-sqlite-search-filename"], "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"], - "sqlite-db-path", "sqlite db path", &settings["sqlite-db-path"], - "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) { @@ -723,12 +703,6 @@ struct OptActions { @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"]; } @@ -740,6 +714,12 @@ struct OptActions { ? (settings["cgi-sqlite-search-filename"].translate(['-' : "_"]) ~ ".d") : ""; } + @trusted string cgi_url_root() { + return settings["cgi-url-root"]; + } + @trusted string cgi_url_action() { + return settings["cgi-url-action"]; + } @trusted string hash_digest_type() { return settings["set-digest"]; } @@ -749,16 +729,16 @@ struct OptActions { @trusted string latex_papersize() { return settings["set-papersize"]; } - @trusted string webserver_host_name() { + @trusted string webserver_host_name() { return settings["www-host"]; } - @trusted string webserver_host_doc_root() { + @trusted string webserver_host_doc_root() { return settings["www-host-doc-root"]; } - @trusted string webserver_url_doc_root() { + @trusted string webserver_url_doc_root() { return settings["www-url-doc-root"]; } - @trusted string webserver_http() { + @trusted string webserver_http() { return settings["www-http"]; } @trusted bool parallelise() { @@ -932,7 +912,7 @@ if ( _conf_file_details = configFilePaths!()(_manifested, _env, _opt_action.config_path_set); auto _config_local_site_struct = readConfigSite!()(_conf_file_details, _opt_action, _cfg); import doc_reform.meta.conf_make_meta_yaml; - _siteConfig = _config_local_site_struct.configParseYAMLreturnSpineStruct!()(_siteConfig, _manifested, _opt_action); // - get local site config + _siteConfig = _config_local_site_struct.configParseYAMLreturnSpineStruct!()(_siteConfig, _manifested, _opt_action, _cfg); // - get local site config break; } } @@ -940,7 +920,7 @@ if ( } else { /+ local site config +/ auto _config_local_site_struct = readConfigSite!()(_conf_file_details, _opt_action, _cfg); import doc_reform.meta.conf_make_meta_yaml; - _siteConfig = _config_local_site_struct.configParseYAMLreturnSpineStruct!()(_siteConfig, _manifested, _opt_action); // - get local site config + _siteConfig = _config_local_site_struct.configParseYAMLreturnSpineStruct!()(_siteConfig, _manifested, _opt_action, _cfg); // - get local site config } if (_opt_action.show_config) { import doc_reform.meta.metadoc_show_config; @@ -1143,7 +1123,7 @@ foreach(arg; args[1..$]) { { /+ document config/make file +/ auto _config_document_struct = readConfigDoc!()(_manifest, _env); import doc_reform.meta.conf_make_meta_yaml; - _make_and_meta_struct = _config_document_struct.configParseYAMLreturnSpineStruct!()(_make_and_meta_struct, _manifest, _opt_action); + _make_and_meta_struct = _config_document_struct.configParseYAMLreturnSpineStruct!()(_make_and_meta_struct, _manifest, _opt_action, _cfg); } #+END_SRC @@ -1190,7 +1170,7 @@ if ((_opt_action.debug_do) ) { writeln("--->\nstepX commence → (document abstraction)"); } -auto t = spineAbstraction!()(_env, program_info, _opt_action, manifest, _make_and_meta_struct); +auto t = spineAbstraction!()(_env, program_info, _opt_action, _cfg, manifest, _make_and_meta_struct); static assert(t.length==2); auto doc_abstraction = t[dAM.abstraction]; auto doc_matters = t[dAM.matters]; @@ -1357,10 +1337,11 @@ template spineAbstraction() { enum makeMeta { make, meta } enum docAbst { doc_abstract_obj, doc_has } static auto rgx = RgxI(); - @system auto spineAbstraction(E,P,O,M,S)( + @system auto spineAbstraction(E,P,O,Cfg,M,S)( E _env, P program_info, O _opt_action, + Cfg _cfg, M _manifest, S _make_and_meta_struct ){ @@ -1463,6 +1444,7 @@ _make_and_meta_struct = _make_and_meta_struct, _manifest, _opt_action, + _cfg, ); if ((_opt_action.debug_do) || (_opt_action.very_verbose) -- cgit v1.2.3