From eed0938b23d13ec4f2ef4588ccdb2e7abc0c1552 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 29 Mar 2020 18:29:44 -0400 Subject: 0.10.0 search sqlite & cgi --- src/doc_reform/meta/conf_make_meta_yaml.d | 166 ++++++++++++++++++++++++------ 1 file changed, 135 insertions(+), 31 deletions(-) (limited to 'src/doc_reform/meta/conf_make_meta_yaml.d') diff --git a/src/doc_reform/meta/conf_make_meta_yaml.d b/src/doc_reform/meta/conf_make_meta_yaml.d index 2efd515..1b5ec70 100644 --- a/src/doc_reform/meta/conf_make_meta_yaml.d +++ b/src/doc_reform/meta/conf_make_meta_yaml.d @@ -187,57 +187,161 @@ template contentYAMLtoSpineStruct() { if (_yaml["webserv"].type.mapping && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map) ) { - if ("url_root" in _yaml["webserv"] - && _yaml["webserv"]["url_root"].type.string - && _yaml["webserv"]["url_root"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.webserv_url_doc_root = _yaml["webserv"]["url_root"].get!string; - if (auto m = _struct_composite.conf.webserv_url_doc_root.match(rgx.webserv_url_doc_root)) { - _struct_composite.conf.webserv_url_domain = m.captures[2].to!string; - _struct_composite.conf.webserv_url_doc_path = m.captures[3].to!string; - } + if ("http" in _yaml["webserv"] + && _yaml["webserv"]["http"].type.string + && _yaml["webserv"]["http"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.w_srv_http = _yaml["webserv"]["http"].get!string; + } // else { set default? } + if ("data_http" in _yaml["webserv"] + && _yaml["webserv"]["data_http"].type.string + && _yaml["webserv"]["data_http"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.w_srv_data_http = _yaml["webserv"]["data_http"].get!string; + } + if ("cgi_http" in _yaml["webserv"] + && _yaml["webserv"]["cgi_http"].type.string + && _yaml["webserv"]["cgi_http"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.w_srv_cgi_http = _yaml["webserv"]["cgi_http"].get!string; + } + if ("domain" in _yaml["webserv"] + && _yaml["webserv"]["domain"].type.string + && _yaml["webserv"]["domain"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.w_srv_domain = _yaml["webserv"]["domain"].get!string; + } + // if ("data_root_url" in _yaml["webserv"] + // && _yaml["webserv"]["data_root_url"].type.string + // && _yaml["webserv"]["data_root_url"].tag.match(rgx.yaml_tag_is_str) + // ) { + // _struct_composite.conf.w_srv_data_root_url = _yaml["webserv"]["data_root_url"].get!string; + // if (auto m = _struct_composite.conf.w_srv_data_root_url.match(rgx.webserv_url_doc_root)) { + // _struct_composite.conf.w_srv_url_domain = m.captures[2].to!string; + // _struct_composite.conf.w_srv_url_doc_path = m.captures[3].to!string; + // } + // } + if ("data_root_path" in _yaml["webserv"] + && _yaml["webserv"]["data_root_path"].type.string + && _yaml["webserv"]["data_root_path"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.w_srv_data_root_path = _yaml["webserv"]["data_root_path"].get!string; + } + if ("data_root_part" in _yaml["webserv"] + && _yaml["webserv"]["data_root_part"].type.string + && _yaml["webserv"]["data_root_part"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.w_srv_data_root_part = _yaml["webserv"]["data_root_part"].get!string; + } + if ("images_root_part" in _yaml["webserv"] + && _yaml["webserv"]["images_root_part"].type.string + && _yaml["webserv"]["images_root_part"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.w_srv_images_root_part = _yaml["webserv"]["images_root_part"].get!string; } - if ("images" in _yaml["webserv"] - && _yaml["webserv"]["images"].type.string - && _yaml["webserv"]["images"].tag.match(rgx.yaml_tag_is_str) + if ("data_root_url" in _yaml["webserv"] + && _yaml["webserv"]["data_root_url"].type.string + && _yaml["webserv"]["data_root_url"].tag.match(rgx.yaml_tag_is_str) ) { - _struct_composite.conf.webserv_images = _yaml["webserv"]["images"].get!string; + _struct_composite.conf.w_srv_data_root_url = _yaml["webserv"]["data_root_url"].get!string; + } else { + _struct_composite.conf.w_srv_data_root_url = _struct_composite.conf.w_srv_data_root_part; + } + if ("cgi_domain" in _yaml["webserv"] + && _yaml["webserv"]["cgi_domain"].type.string + && _yaml["webserv"]["cgi_domain"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.w_srv_cgi_domain = _yaml["webserv"]["cgi_domain"].get!string; + } else { // composite construct + _struct_composite.conf.w_srv_cgi_domain = _struct_composite.conf.w_srv_domain; } - if ("cgi" in _yaml["webserv"] - && _yaml["webserv"]["cgi"].type.string - && _yaml["webserv"]["cgi"].tag.match(rgx.yaml_tag_is_str) + if ("cgi_title" in _yaml["webserv"] + && _yaml["webserv"]["cgi_title"].type.string + && _yaml["webserv"]["cgi_title"].tag.match(rgx.yaml_tag_is_str) ) { - _struct_composite.conf.webserv_cgi = _yaml["webserv"]["cgi"].get!string; + _struct_composite.conf.w_srv_cgi_title = _yaml["webserv"]["cgi_title"].get!string; } - if ("cgi_host" in _yaml["webserv"] - && _yaml["webserv"]["cgi_host"].type.string - && _yaml["webserv"]["cgi_host"].tag.match(rgx.yaml_tag_is_str) + if ("cgi_bin_part" in _yaml["webserv"] + && _yaml["webserv"]["cgi_bin_part"].type.string + && _yaml["webserv"]["cgi_bin_part"].tag.match(rgx.yaml_tag_is_str) ) { - _struct_composite.conf.webserv_cgi_host = _yaml["webserv"]["cgi_host"].get!string; + _struct_composite.conf.w_srv_cgi_bin_part = _yaml["webserv"]["cgi_bin_part"].get!string; } - if ("cgi_host_path" in _yaml["webserv"] - && _yaml["webserv"]["cgi_host_path"].type.string - && _yaml["webserv"]["cgi_host_path"].tag.match(rgx.yaml_tag_is_str) + if ("cgi_bin_path" in _yaml["webserv"] + && _yaml["webserv"]["cgi_bin_path"].type.string + && _yaml["webserv"]["cgi_bin_path"].tag.match(rgx.yaml_tag_is_str) ) { - _struct_composite.conf.webserv_cgi_host_path = _yaml["webserv"]["cgi_host_path"].get!string; + _struct_composite.conf.w_srv_cgi_bin_path = _yaml["webserv"]["cgi_bin_path"].get!string; + } + if ("cgi_search_script" in _yaml["webserv"] + && _yaml["webserv"]["cgi_search_script"].type.string + && _yaml["webserv"]["cgi_search_script"].tag.match(rgx.yaml_tag_is_str) + ) { + _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"; + } + if ("cgi_search_script_raw_fn_d" in _yaml["webserv"] + && _yaml["webserv"]["cgi_search_script_raw_fn_d"].type.string + && _yaml["webserv"]["cgi_search_script_raw_fn_d"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.w_srv_cgi_search_script_raw_fn_d = _yaml["webserv"]["cgi_search_script_raw_fn_d"].get!string; + } else if ("cgi_search_script" in _yaml["webserv"] + && _yaml["webserv"]["cgi_search_script"].type.string + && _yaml["webserv"]["cgi_search_script"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.w_srv_cgi_search_script_raw_fn_d = (_yaml["webserv"]["cgi_search_script"].get!string).translate(['-' : "_"]) ~ ".d"; + } else { + _struct_composite.conf.w_srv_cgi_search_script_raw_fn_d = "spine_search.d"; } if ("cgi_port" in _yaml["webserv"] && _yaml["webserv"]["cgi_port"].type.string && _yaml["webserv"]["cgi_port"].tag.match(rgx.yaml_tag_is_str) ) { - _struct_composite.conf.webserv_cgi_port = _yaml["webserv"]["cgi_port"].get!string; + _struct_composite.conf.w_srv_cgi_port = _yaml["webserv"]["cgi_port"].get!string; } if ("cgi_user" in _yaml["webserv"] && _yaml["webserv"]["cgi_user"].type.string && _yaml["webserv"]["cgi_user"].tag.match(rgx.yaml_tag_is_str) ) { - _struct_composite.conf.webserv_cgi_user = _yaml["webserv"]["cgi_user"].get!string; + _struct_composite.conf.w_srv_cgi_user = _yaml["webserv"]["cgi_user"].get!string; } - if ("cgi_file_links" in _yaml["webserv"] - && _yaml["webserv"]["cgi_file_links"].type.string - && _yaml["webserv"]["cgi_file_links"].tag.match(rgx.yaml_tag_is_str) + if ("cgi_action" in _yaml["webserv"] + && _yaml["webserv"]["cgi_action"].type.string + && _yaml["webserv"]["cgi_action"].tag.match(rgx.yaml_tag_is_str) ) { - _struct_composite.conf.webserv_cgi_file_links = _yaml["webserv"]["cgi_file_links"].get!string; + _struct_composite.conf.w_srv_cgi_action = _yaml["webserv"]["cgi_action"].get!string; + } else { // action is composite, build + } + if ("cgi_bin_url" in _yaml["webserv"] + && _yaml["webserv"]["cgi_bin_url"].type.string + && _yaml["webserv"]["cgi_bin_url"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.w_srv_cgi_bin_url = _yaml["webserv"]["cgi_bin_url"].get!string; + } else { + _struct_composite.conf.w_srv_cgi_bin_url = + (_struct_composite.conf.w_srv_cgi_http.empty) + ? _struct_composite.conf.w_srv_http + :_struct_composite.conf.w_srv_cgi_http + ~ "://" + ~ (_struct_composite.conf.w_srv_cgi_domain.empty) + ? _struct_composite.conf.w_srv_cgi_domain + : _struct_composite.conf.w_srv_domain + ~ "/" + ~ _struct_composite.conf.w_srv_cgi_bin_part; + } + // if ("cgi_file_links" in _yaml["webserv"] + // && _yaml["webserv"]["cgi_file_links"].type.string + // && _yaml["webserv"]["cgi_file_links"].tag.match(rgx.yaml_tag_is_str) + // ) { + // _struct_composite.conf.w_srv_cgi_file_links = _yaml["webserv"]["cgi_file_links"].get!string; + // } + 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 = _yaml["webserv"]["db_sqlite"].get!string; + } else { // set default ? } } } -- cgit v1.2.3