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 /src/doc_reform | |
parent | spine_search (diff) |
config defaults: cfte, config-file & cle
Diffstat (limited to 'src/doc_reform')
-rw-r--r-- | src/doc_reform/io_in/read_config_files.d | 47 | ||||
-rwxr-xr-x | src/doc_reform/spine.d | 73 |
2 files changed, 91 insertions, 29 deletions
diff --git a/src/doc_reform/io_in/read_config_files.d b/src/doc_reform/io_in/read_config_files.d index 44f93ec..005a436 100644 --- a/src/doc_reform/io_in/read_config_files.d +++ b/src/doc_reform/io_in/read_config_files.d @@ -62,7 +62,7 @@ import doc_reform.meta.rgx; template readConfigSite() { - @system final auto readConfigSite(C,O)(C _conf_file_details, O _opt_action) { + @system final auto readConfigSite(Cf,O,Cfg)(Cf _conf_file_details, O _opt_action, Cfg _cfg) { mixin spineRgxIn; static auto rgx = RgxI(); string conf_filename = "NONE"; @@ -79,28 +79,43 @@ default: text_wrap: "80" digest: "sha256" webserv: - http: "http" - domain: "localhost" - data_http: "http" - data_domain: "localhost" - data_root_url: "http://localhost" - data_root_path: "/var/www/html" + 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: "≅ SiSU Spine search" - cgi_http: "http" - cgi_domain: "localhost" - cgi_bin_url: "http://localhost/cgi-bin" + cgi_title: "%s" + cgi_http: "%s" + cgi_domain: "%s" + cgi_bin_url: "%s" cgi_bin_part: "cgi-bin" - cgi_bin_path: "/usr/lib/cgi-bin" - cgi_search_script: "spine-search" + cgi_bin_path: "%s" + cgi_search_script: "%s" cgi_port: "" cgi_user: "" - cgi_action: "http://localhost/cgi-bin/spine-search" - db_sqlite: "spine.search.db" + cgi_action: "%s" + db_sqlite: "%s" db_pg_table: "" db_pg_user: "" -┃"); +┃", + _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_filename, // db filename +); foreach(conf_fn; [_conf_file_details.config_filename_site]) { foreach(pth; _conf_file_details.possible_config_path_locations.config_local_site) { char[] conf_file; 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 } |