aboutsummaryrefslogtreecommitdiffhomepage
path: root/org
diff options
context:
space:
mode:
Diffstat (limited to 'org')
-rw-r--r--org/cgi_spine_search.org97
-rw-r--r--org/config_d_cfte.org66
-rw-r--r--org/default_paths.org2
-rw-r--r--org/in_source_files.org53
-rw-r--r--org/meta_conf_make_meta.org26
-rw-r--r--org/out_cgi_search_sqlite.org2
-rw-r--r--org/out_harvest_metadata.org4
-rw-r--r--org/out_metadata.org4
-rw-r--r--org/out_sqlite.org42
-rw-r--r--org/out_xmls.org4
-rw-r--r--org/output_hub.org2
-rw-r--r--org/output_show.org4
-rw-r--r--org/spine.org49
13 files changed, 194 insertions, 161 deletions
diff --git a/org/cgi_spine_search.org b/org/cgi_spine_search.org
index 0168f66..b695783 100644
--- a/org/cgi_spine_search.org
+++ b/org/cgi_spine_search.org
@@ -20,34 +20,6 @@
[[./spine_build_scaffold.org][make/build]] VERSION
* 0. version.txt configuration.txt (set version & configuration)
-** 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
@@ -108,7 +80,7 @@ void cgi_function_intro(Cgi cgi) {
<<spine_search_init_1>>
<<spine_search_config>>
<<spine_search_cgi_val>>
- cv.db_selected = _cfg.filename_db;
+ cv.db_selected = _cfg.db_sqlite_filename;
auto text_fields() {
string canned_query_str = environment.get("QUERY_STRING", "");
if ("query_string" in cgi.post) {
@@ -140,9 +112,9 @@ void cgi_function_intro(Cgi cgi) {
string canned_url () {
string _url = "";
if (environment.get("REQUEST_METHOD", "POST") == "POST") {
- _url = conf.query_base ~ tf.canned_query;
+ _url = conf.query_base_url ~ tf.canned_query;
} else if (environment.get("REQUEST_METHOD", "POST") == "GET") {
- _url = conf.query_base ~ environment.get("QUERY_STRING", "");
+ _url = conf.query_base_url ~ environment.get("QUERY_STRING", "");
}
return _url;
}
@@ -204,7 +176,7 @@ void cgi_function_intro(Cgi cgi) {
// <<spine_search_debug_info>>
}
}
- auto db = Database(conf.db_path ~ cv.db_selected);
+ auto db = Database(conf.db_path ~ "/" ~ cv.db_selected);
{
uint sql_match_offset_counter(T)(T cv) {
sql_match_offset_count += cv.sql_match_limit.to!uint;
@@ -270,21 +242,24 @@ uint sql_match_offset_count = 0;
**** config
+see: cfte_configuation.org
+
#+NAME: spine_search_config
#+BEGIN_SRC d
<<spine_search_config_struct>>
auto conf = Config();
conf.http_request_type = environment.get("REQUEST_SCHEME", _cfg.http_request_type);
-conf.http_host = environment.get("HTTP_HOST", _cfg.http_host);
-conf.web_doc_root_path = environment.get("DOCUMENT_ROOT", _cfg.doc_root_www);
+conf.http_host = environment.get("SERVER_NAME", _cfg.http_host);
+// conf.http_host = environment.get("HTTP_HOST", _cfg.http_host);
+conf.web_doc_root_path = environment.get("DOCUMENT_ROOT", _cfg.www_doc_root);
conf.doc_collection_sub_root = "<<doc_subroot_path>>"; // (output_path - web_doc_root_path)
-conf.cgi_root = environment.get("CONTEXT_DOCUMENT_ROOT", _cfg.host_cgi_subpath);
-conf.cgi_script = environment.get("SCRIPT_NAME", _cfg.filename_cgi);
+conf.cgi_root = environment.get("CONTEXT_DOCUMENT_ROOT", _cfg.cgi_bin_subpath);
+conf.cgi_script_name = environment.get("SCRIPT_NAME", _cfg.cgi_filename);
+conf.query_base_url = conf.http_request_type ~ "://" ~ conf.http_host ~ "/" ~ conf.cgi_script_name ~ "?";
conf.query_string = environment.get("QUERY_STRING", "");
-conf.db_path = _cfg.doc_root_db;
+conf.http_url = environment.get("HTTP_REFERER", conf.query_base_url ~ conf.query_string);
conf.request_method = environment.get("REQUEST_METHOD", "POST");
-conf.query_base = conf.http_request_type ~ "://" ~ conf.http_host ~ conf.cgi_script ~ "?";
-conf.http_url = environment.get("HTTP_REFERER", conf.query_base ~ conf.query_string);
+conf.db_path = _cfg.db_sqlite_path;
#+END_SRC
#+NAME: spine_search_config_struct
@@ -296,13 +271,13 @@ struct Config {
string web_doc_root_path;
string doc_collection_sub_root;
string cgi_root;
- string cgi_script;
+ string cgi_script_name;
string data_path_html;
- string db_path;
- string query_string;
string http_url;
+ string query_base_url;
+ string query_string;
string request_method;
- string query_base;
+ string db_path;
}
#+END_SRC
@@ -654,7 +629,6 @@ if (environment.get("REQUEST_METHOD", "POST") == "POST") {
}
#+END_SRC
-
**** show_matched_objects (string fn) {}
#+NAME: spine_search_show_matched_objects
@@ -832,9 +806,9 @@ string show_the_can = post_value("url");
string _the_can = "";
if (show_the_can == "checked") {
tf = text_fields;
- string method_get_url = conf.query_base ~ environment.get("QUERY_STRING", "");
- string method_post_url_construct = conf.query_base ~ tf.canned_query;
- // assert(method_get_url == environment.get("HTTP_REFERER", conf.query_base ~ conf.query_string));
+ string method_get_url = conf.query_base_url ~ environment.get("QUERY_STRING", "");
+ string method_post_url_construct = conf.query_base_url ~ tf.canned_query;
+ // assert(method_get_url == environment.get("HTTP_REFERER", conf.query_base_url ~ conf.query_string));
if (conf.request_method == "POST") {
_the_can =
"<font size=\"2\" color=\"#666666\">"
@@ -855,7 +829,7 @@ if (show_the_can == "checked") {
~ method_get_url
~ "</a></font>";
}
- conf.http_url = conf.http_request_type ~ "://" ~ conf.http_host ~ conf.cgi_script ~ tf.canned_query;
+ conf.http_url = conf.http_request_type ~ "://" ~ conf.http_host ~ conf.cgi_script_name ~ tf.canned_query;
}
return _the_can;
#+END_SRC
@@ -901,7 +875,7 @@ return tip;
form = format(q"┃
<<spine_search_form_html>>
┃",
- _cfg.filename_cgi,
+ _cfg.cgi_filename,
(post_value("ec") == "checked") ? post_value("sf", "field") : "",
provide_tip,
search_note,
@@ -984,7 +958,7 @@ return val;
#+NAME: spine_search_set_selections
#+BEGIN_SRC d
-cv.db_selected = set_value("selected_db", _cfg.filename_db); // selected_db_name == db (spine.search.db or whatever)
+cv.db_selected = set_value("selected_db", _cfg.db_sqlite_filename); // selected_db_name == db (spine.search.db or whatever)
cv.sql_match_limit = set_value("sml", "1000");
cv.sql_match_offset = set_value("smo", "0");
cv.search_text = set_value("sf", "");
@@ -1268,6 +1242,9 @@ if (!select_query_results.empty) {
#+NAME: spine_search_debug_info
#+BEGIN_SRC d
+cgi.write("db with path: " ~ conf.db_path ~ "/" ~ cv.db_selected ~ "<br>\n");
+cgi.write("http url: " ~ conf.http_url ~ "<br>\n");
+cgi.write("query base url: " ~ conf.query_base_url ~ "<br>\n");
cgi.write("db_selected: " ~ cv.db_selected ~ "<br>\n");
cgi.write("search_text: " ~ cv.search_text ~ "<br>\n");
cgi.write("sql_match_limit: " ~ cv.sql_match_limit ~ ";\n");
@@ -2114,28 +2091,12 @@ _cfg.doc_root_cgi
_cfg.doc_root_db
#+END_SRC
#+BEGIN_SRC text
-<<url_doc_root>>/spine/static/sqlite/
+/var/www/sqlite/
#+END_SRC
*** spine_search configuration.txt
-#+HEADER: :tangle "../sundry/spine_search_cgi/views/configuration_suggested.txt"
-#+BEGIN_SRC d
-/+ obt - org-mode generated file +/
-struct Cfg {
- string http_request_type = "http";
- string http_host = "localhost";
- string doc_root_www = "/srv/www/spine/static";
- string doc_root_cgi = "/var/www/cgi/cgi-bin/";
- string doc_root_db = "/srv/www/spine/static/sqlite/";
- string host_cgi_subpath = "/cgi-bin";
- // string subpath_cgi = "/cgi-bin/";
- string filename_cgi = "spine_search";
- string cgi_script_filename_with_any_subpath = "/cgi-bin/spine_search";
- string filename_db = "spine.search.db";
-}
-enum _cfg = Cfg();
-#+END_SRC
+see configuration_cfte.org
*** document header including copyright & license
diff --git a/org/config_d_cfte.org b/org/config_d_cfte.org
new file mode 100644
index 0000000..5755b02
--- /dev/null
+++ b/org/config_d_cfte.org
@@ -0,0 +1,66 @@
+-*- mode: org -*-
+#+TITLE: configuration d cfte
+#+DESCRIPTION: documents - structuring, various output representations & search
+#+FILETAGS: :spine:hub:
+#+AUTHOR: Ralph Amissah
+#+EMAIL: [[mailto:ralph.amissah@gmail.com][ralph.amissah@gmail.com]]
+#+COPYRIGHT: Copyright (C) 2015 - 2021 Ralph Amissah
+#+LANGUAGE: en
+#+STARTUP: content hideblocks hidestars noindent entitiespretty
+#+OPTIONS: H:3 num:nil toc:t \n:nil @:t ::t |:t ^:nil _:nil -:t f:t *:t <:t
+#+PROPERTY: header-args :exports code
+#+PROPERTY: header-args+ :noweb yes
+#+PROPERTY: header-args+ :eval no
+#+PROPERTY: header-args+ :results no
+#+PROPERTY: header-args+ :cache no
+#+PROPERTY: header-args+ :padline no
+#+PROPERTY: header-args+ :mkdirp yes
+
+* cfte views SET
+** spine configuration.txt
+
+#+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_path = "/var/www/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
+
+** spine_search configuration.txt
+
+#+HEADER: :tangle "../sundry/spine_search_cgi/views/configuration_suggested.txt"
+#+BEGIN_SRC d
+/+ obt - org-mode generated file +/
+struct Cfg {
+ string http_request_type = "http";
+ string http_host = "localhost";
+ string www_url_doc_root = "http://localhost";
+ string www_doc_root = "/srv/www/spine/static"; // "/var/www/html"
+ string cgi_bin_root = "/var/www/cgi/cgi-bin/"; // "/usr/lib/cgi-bin"
+ string cgi_bin_subpath = "/cgi-bin";
+ string cgi_filename = "spine_search"; // "spine-search"
+ string db_sqlite_path = "/var/www/sqlite";
+ string db_sqlite_filename = "spine.search.db";
+}
+enum _cfg = Cfg();
+#+END_SRC
diff --git a/org/default_paths.org b/org/default_paths.org
index ae01fcd..2bf0d14 100644
--- a/org/default_paths.org
+++ b/org/default_paths.org
@@ -1615,7 +1615,7 @@ template spinePathsSQLite() {
}
string base() {
auto out_pth = spineOutPathSQLite!()(output_pth_root); // decide whether to have separate files for each language
- string base_dir = "sqlite";
+ string base_dir = "";
return (((out_pth.output_root).chainPath(base_dir)).asNormalizedPath).array;
}
string sqlite_file() {
diff --git a/org/in_source_files.org b/org/in_source_files.org
index 6658358..d460566 100644
--- a/org/in_source_files.org
+++ b/org/in_source_files.org
@@ -72,35 +72,37 @@ flag:
act0: "--html"
act1: "--html --epub"
output:
- path: "/var/www/html"
+ path: "%s"
default:
language: "en"
papersize: "a4"
- text_wrap: "80"
- digest: "sha256"
+ 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: "%s"
- db_pg_table: ""
- db_pg_user: ""
+ 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: ""
┃",
+ _cfg.www_doc_root, // doc root
_cfg.www_http, // http
_cfg.www_domain, // domain
_cfg.www_http, // data http
@@ -114,7 +116,8 @@ webserv:
_cfg.cgi_bin_root, // cgi bin path
_cfg.cgi_filename, // cgi filename
_cfg.cgi_url_action, // cgi action
- _cfg.db_sqlite_filename, // db filename
+ _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/org/meta_conf_make_meta.org b/org/meta_conf_make_meta.org
index 676d395..e162bcc 100644
--- a/org/meta_conf_make_meta.org
+++ b/org/meta_conf_make_meta.org
@@ -47,7 +47,7 @@ webserv:
cgi_bin_part: "cgi-bin"
cgi_bin_path: "/usr/lib/cgi-bin"
cgi_search_title: "≅ SiSU spine search form"
- cgi_search_script: "spine-search"
+ cgi_search_script: "spine_search"
cgi_search_script_raw_fn_d: "spine_search.d"
cgi_port: ""
cgi_user: ""
@@ -284,7 +284,8 @@ struct ConfCompositeSiteLocal {
string w_srv_cgi_user;
string w_srv_cgi_action;
string w_srv_cgi_bin_url;
- string w_srv_db_sqlite;
+ string w_srv_db_sqlite_filename;
+ string w_srv_db_sqlite_path;
// string w_srv_db_pg;
string w_srv_db_pg_table;
string w_srv_db_pg_user;
@@ -722,7 +723,7 @@ if ("webserv" in _yaml
) {
_struct_composite.conf.w_srv_cgi_search_script = _yaml["webserv"]["cgi_search_script"].get!string;
} else {
- _struct_composite.conf.w_srv_cgi_search_script = "spine-search";
+ _struct_composite.conf.w_srv_cgi_search_script = "spine_search";
}
if (_opt_action.cgi_sqlite_search_filename_d.length > 0) {
_struct_composite.conf.w_srv_cgi_search_script_raw_fn_d = _opt_action.cgi_sqlite_search_filename_d;
@@ -784,12 +785,21 @@ if ("webserv" in _yaml
// _struct_composite.conf.w_srv_cgi_file_links = _yaml["webserv"]["cgi_file_links"].get!string;
// }
if (_opt_action.sqlite_filename.length > 0) {
- _struct_composite.conf.w_srv_db_sqlite = _opt_action.sqlite_filename;
- } else if ("db_sqlite" in _yaml["webserv"]
- && _yaml["webserv"]["db_sqlite"].type.string
- && _yaml["webserv"]["db_sqlite"].tag.match(rgx.yaml_tag_is_str)
+ _struct_composite.conf.w_srv_db_sqlite_filename = _opt_action.sqlite_filename;
+ } else if ("db_sqlite_filename" in _yaml["webserv"]
+ && _yaml["webserv"]["db_sqlite_filename"].type.string
+ && _yaml["webserv"]["db_sqlite_filename"].tag.match(rgx.yaml_tag_is_str)
) {
- _struct_composite.conf.w_srv_db_sqlite = _yaml["webserv"]["db_sqlite"].get!string;
+ _struct_composite.conf.w_srv_db_sqlite_filename = _yaml["webserv"]["db_sqlite_filename"].get!string;
+ } else { // set default ?
+ }
+ if (_opt_action.sqlite_path.length > 0) {
+ _struct_composite.conf.w_srv_db_sqlite_path = _opt_action.sqlite_path;
+ } else if ("db_sqlite_path" in _yaml["webserv"]
+ && _yaml["webserv"]["db_sqlite_path"].type.string
+ && _yaml["webserv"]["db_sqlite_path"].tag.match(rgx.yaml_tag_is_str)
+ ) {
+ _struct_composite.conf.w_srv_db_sqlite_path = _yaml["webserv"]["db_sqlite_path"].get!string;
} else { // set default ?
}
}
diff --git a/org/out_cgi_search_sqlite.org b/org/out_cgi_search_sqlite.org
index 64adb91..d8d9064 100644
--- a/org/out_cgi_search_sqlite.org
+++ b/org/out_cgi_search_sqlite.org
@@ -80,7 +80,7 @@ template CGIsearchSQLite() {
std.format;
import doc_reform.io_out;
string _sqlite_db_fn = (opt_action.sqlite_filename.empty)
- ? make_and_meta_struct.conf.w_srv_db_sqlite
+ ? make_and_meta_struct.conf.w_srv_db_sqlite_filename
: opt_action.sqlite_filename;
string _cgi_search_script = (opt_action.cgi_sqlite_search_filename.empty)
? make_and_meta_struct.conf.w_srv_cgi_search_script
diff --git a/org/out_harvest_metadata.org b/org/out_harvest_metadata.org
index 4cf23cf..c3d4fff 100644
--- a/org/out_harvest_metadata.org
+++ b/org/out_harvest_metadata.org
@@ -813,10 +813,10 @@ string theme_light_1 = format(q"┃
<!-- SiSU Spine Search -->
</div>┃",
_make_and_meta_struct.conf.w_srv_cgi_action,
- (_make_and_meta_struct.conf.w_srv_db_sqlite.empty)
+ (_make_and_meta_struct.conf.w_srv_db_sqlite_filename.empty)
? ""
: "\n <input type=\"hidden\" name=\"db\" value=\""
- ~ _make_and_meta_struct.conf.w_srv_db_sqlite
+ ~ _make_and_meta_struct.conf.w_srv_db_sqlite_filename
~ "\">",
);
} else {
diff --git a/org/out_metadata.org b/org/out_metadata.org
index 94d71b7..6688bca 100644
--- a/org/out_metadata.org
+++ b/org/out_metadata.org
@@ -553,10 +553,10 @@ string theme_light_1 = format(q"┃
<!-- SiSU Spine Search -->
</div>┃",
doc_matters.conf_make_meta.conf.w_srv_cgi_action,
- (doc_matters.conf_make_meta.conf.w_srv_db_sqlite.empty)
+ (doc_matters.conf_make_meta.conf.w_srv_db_sqlite_filename.empty)
? ""
: "\n <input type=\"hidden\" name=\"db\" value=\""
- ~ doc_matters.conf_make_meta.conf.w_srv_db_sqlite
+ ~ doc_matters.conf_make_meta.conf.w_srv_db_sqlite_filename
~ "\">",
doc_matters.src.filename_base,
);
diff --git a/org/out_sqlite.org b/org/out_sqlite.org
index 58de0cf..2f09101 100644
--- a/org/out_sqlite.org
+++ b/org/out_sqlite.org
@@ -81,7 +81,7 @@ template SQLiteHubBuildTablesAndPopulate() {
const D doc_abstraction,
M doc_matters,
) {
- auto pth_sqlite = spinePathsSQLite!()(doc_matters.sqlite.filename, doc_matters.output_path);
+ auto pth_sqlite = spinePathsSQLite!()(doc_matters.sqlite.filename, doc_matters.sqlite.path);
pth_sqlite.base.mkdirRecurse;
auto db = Database(pth_sqlite.sqlite_file);
template SQLiteDbStatementComposite() {
@@ -111,7 +111,7 @@ template SQLiteHubDiscreteBuildTablesAndPopulate() {
M doc_matters,
) {
auto url_html = spineUrlsHTML!()(doc_matters.conf_make_meta.conf.w_srv_data_root_url_html, doc_matters.src.language);
- auto pth_sqlite = spinePathsSQLiteDiscrete!()(doc_matters.output_path, doc_matters.src.language);
+ auto pth_sqlite = spinePathsSQLiteDiscrete!()(doc_matters.output_path, doc_matters.src.language); // doc_matters.db_path
pth_sqlite.base.mkdirRecurse;
auto db = Database(pth_sqlite.sqlite_file(doc_matters.src.filename));
template SQLiteDiscreteDbStatementComposite() {
@@ -328,19 +328,19 @@ template SQLiteTablesCreate() {
string _db_statement;
string db_filename = (opt_action.sqlite_filename.length > 0)
? opt_action.sqlite_filename
- : (config.conf.w_srv_db_sqlite.length > 0)
- ? config.conf.w_srv_db_sqlite
+ : (config.conf.w_srv_db_sqlite_filename.length > 0)
+ ? config.conf.w_srv_db_sqlite_filename
: "";
- string output_path = (opt_action.output_dir_set.length > 0)
+ string db_path = (opt_action.output_dir_set.length > 0)
? opt_action.output_dir_set
- : (config.conf.output_path.length > 0)
- ? config.conf.output_path
+ : (config.conf.w_srv_db_sqlite_path.length > 0)
+ ? config.conf.w_srv_db_sqlite_path
: "";
- if (db_filename.length > 0 && output_path.length > 0) {
+ if (db_filename.length > 0 && db_path.length > 0) {
if ((opt_action.verbose)) {
- writeln("db name & path: ", config.conf.output_path, "/sqlite/", db_filename);
+ writeln("db name & path: ", db_path, db_filename);
}
- auto pth_sqlite = spinePathsSQLite!()(db_filename, output_path);
+ auto pth_sqlite = spinePathsSQLite!()(db_filename, db_path);
pth_sqlite.base.mkdirRecurse;
auto db = Database(pth_sqlite.sqlite_file);
{
@@ -350,7 +350,7 @@ template SQLiteTablesCreate() {
} else {
writeln("must provide db name & output root path either on the command line or in configuration file");
writeln("db name: ", db_filename);
- writeln("output root path (path less /sqlite which is added: ", config.conf.output_path);
+ writeln("db path: ", db_path);
}
}
}
@@ -367,16 +367,16 @@ template SQLiteDbDrop() {
if ((opt_action.sqlite_db_drop)) {
string db_filename = (opt_action.sqlite_filename.length > 0)
? opt_action.sqlite_filename
- : (config.conf.w_srv_db_sqlite.length > 0)
- ? config.conf.w_srv_db_sqlite
+ : (config.conf.w_srv_db_sqlite_filename.length > 0)
+ ? config.conf.w_srv_db_sqlite_filename
: "";
- string output_path = (opt_action.output_dir_set.length > 0)
- ? opt_action.output_dir_set
- : (config.conf.output_path.length > 0)
- ? config.conf.output_path
+ string db_path = (opt_action.sqlite_db_path.length > 0) //
+ ? opt_action.sqlite_db_path
+ : (config.conf.w_srv_db_sqlite_path.length > 0)
+ ? config.conf.w_srv_db_sqlite_path
: "";
- if (db_filename.length > 0 && output_path.length > 0) {
- auto pth_sqlite = spinePathsSQLite!()(db_filename, output_path);
+ if (db_filename.length > 0 && db_path.length > 0) {
+ auto pth_sqlite = spinePathsSQLite!()(db_filename, db_path);
writeln("remove(", pth_sqlite.sqlite_file, ")");
try {
remove(pth_sqlite.sqlite_file);
@@ -386,7 +386,7 @@ template SQLiteDbDrop() {
} else {
writeln("must provide db name & output root path either on the command line or in configuration file");
writeln("db name: ", db_filename);
- writeln("output root path (path less /sqlite which is added: ", config.conf.output_path);
+ writeln("db path: ", db_path);
}
}
}
@@ -402,7 +402,7 @@ template SQLiteDbDrop() {
{
string _db_statement;
if ((doc_matters.opt.action.sqlite_db_create)) {
- auto pth_sqlite = spinePathsSQLite!()(doc_matters.sqlite.filename, doc_matters.output_path);
+ auto pth_sqlite = spinePathsSQLite!()(doc_matters.sqlite.filename, doc_matters.sqlite.path);
pth_sqlite.base.mkdirRecurse;
_db_statement ~= SQLiteTablesReCreate!()();
SQLiteDbRun!()(db, _db_statement, doc_matters.opt.action, "TABLE RE-CREATE");
diff --git a/org/out_xmls.org b/org/out_xmls.org
index 0538964..12cd0dc 100644
--- a/org/out_xmls.org
+++ b/org/out_xmls.org
@@ -315,10 +315,10 @@ import
<!-- SiSU Spine Search -->
</div>┃",
doc_matters.conf_make_meta.conf.w_srv_cgi_action,
- (doc_matters.conf_make_meta.conf.w_srv_db_sqlite.empty)
+ (doc_matters.conf_make_meta.conf.w_srv_db_sqlite_filename.empty)
? ""
: "\n <input type=\"hidden\" name=\"db\" value=\""
- ~ doc_matters.conf_make_meta.conf.w_srv_db_sqlite
+ ~ doc_matters.conf_make_meta.conf.w_srv_db_sqlite_filename
~ "\">",
doc_matters.src.filename_base,
);
diff --git a/org/output_hub.org b/org/output_hub.org
index 67718e1..3957e6e 100644
--- a/org/output_hub.org
+++ b/org/output_hub.org
@@ -269,7 +269,7 @@ if ((opt_action.sqlite_db_create)) {
if ((opt_action.cgi_search_form_codegen)) {
if ((opt_action.verbose)) {
string _sqlite_db_fn = (opt_action.sqlite_filename.empty)
- ? config.conf.w_srv_db_sqlite
+ ? config.conf.w_srv_db_sqlite_filename
: opt_action.sqlite_filename;
string _cgi_search_script = (opt_action.cgi_sqlite_search_filename.empty)
? config.conf.w_srv_cgi_search_script
diff --git a/org/output_show.org b/org/output_show.org
index 80529e4..4b93134 100644
--- a/org/output_show.org
+++ b/org/output_show.org
@@ -208,7 +208,7 @@ writefln(
// "- webserv cgi file links:",
// config.conf.w_srv_cgi_file_links,
"- webserv sqlite db:",
- config.conf.w_srv_db_sqlite,
+ config.conf.w_srv_db_sqlite_filename,
"- output path:",
config.conf.output_path,
"- processing concordance max:",
@@ -298,7 +298,7 @@ writefln(
// "- webserv cgi file links:",
// doc_matters.conf_make_meta.conf.w_srv_cgi_file_links,
"- webserv sqlite db:",
- doc_matters.conf_make_meta.conf.w_srv_db_sqlite,
+ doc_matters.conf_make_meta.conf.w_srv_db_sqlite_filename,
"- output path:",
doc_matters.conf_make_meta.conf.output_path,
"- processing concordance max:",
diff --git a/org/spine.org b/org/spine.org
index ad2cf86..c27a3be 100644
--- a/org/spine.org
+++ b/org/spine.org
@@ -31,32 +31,7 @@
** 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
+see: cfte_configuation.org
** program version struct
@@ -490,6 +465,7 @@ string[string] settings = [
"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"
];
#+END_SRC
@@ -578,6 +554,7 @@ 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"],
+ "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"],
);
@@ -697,6 +674,9 @@ struct OptActions {
@trusted bool source_or_pod() {
return (opts["pod"] || opts["source"]) ? true : false;
}
+ @trusted string sqlite_db_path() {
+ return settings["sqlite-db-path"];
+ }
@trusted string sqlite_db_filename() {
return settings["sqlite-db-filename"];
}
@@ -775,6 +755,9 @@ struct OptActions {
@trusted string sqlite_filename() {
return settings["sqlite-db-filename"];
}
+ @trusted string sqlite_path() {
+ return settings["sqlite-db-path"];
+ }
@trusted string cgi_bin_root() {
return settings["cgi-bin-root"];
}
@@ -1689,13 +1672,23 @@ struct DocumentMatters {
struct SQLite_ {
@safe string filename() {
string _fn = "";
+ string _pth = "";
if (_opt_action.sqlite_filename.length > 0) {
_fn = _opt_action.sqlite_filename;
- } else if (_make_and_meta_struct.conf.w_srv_db_sqlite.length > 0) {
- _fn = _make_and_meta_struct.conf.w_srv_db_sqlite;
+ } else if (_make_and_meta_struct.conf.w_srv_db_sqlite_filename.length > 0) {
+ _fn = _make_and_meta_struct.conf.w_srv_db_sqlite_filename;
}
return _fn;
}
+ @safe string path() {
+ string _pth = "";
+ if (_opt_action.sqlite_path.length > 0) {
+ _pth = _opt_action.sqlite_path;
+ } else if (_make_and_meta_struct.conf.w_srv_db_sqlite_path.length > 0) {
+ _pth = _make_and_meta_struct.conf.w_srv_db_sqlite_path;
+ }
+ return _pth;
+ }
@safe string cgi_filename() {
string _fn = "";
if (_opt_action.cgi_sqlite_search_filename.length > 0) {