-*- 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 - 2023 Ralph Amissah
#+LANGUAGE:    en
#+STARTUP:     content hideblocks hidestars noindent entitiespretty
#+PROPERTY:    header-args  :exports code
#+PROPERTY:    header-args+ :noweb yes
#+PROPERTY:    header-args+ :results no
#+PROPERTY:    header-args+ :cache no
#+PROPERTY:    header-args+ :padline no
#+PROPERTY:    header-args+ :mkdirp yes
#+OPTIONS:     H:3 num:nil toc:t \n:t ::t |:t ^:nil -:t f:t *:t

- [[./doc-reform.org][doc-reform.org]]  [[../org/][org/]]

* cfte views version.txt configuration.txt (set version & configuration) SET

** program version: version.txt

*** set program version SET VERSION :version:set:project:

- comma separated numbers: major, minor, patch

#+NAME: spine_version_set
#+BEGIN_SRC d
0, 14, 0
#+END_SRC

*** set program version tangle :version:

#+HEADER: :tangle "../views/version.txt"
#+HEADER: :noweb yes
#+BEGIN_SRC txt
/+ obt - org-mode generated file +/
struct Version {
  int major;
  int minor;
  int patch;
}
enum _ver = Version(<<spine_version_set>>);
<<spine_compiler_restrictions>>
#+END_SRC

*** compilation restrictions (supported compilers)
- set compilation restrictions

https://dlang.org/spec/version.html#predefined-versions

#+NAME: spine_compiler_restrictions
#+HEADER: :noweb yes
#+BEGIN_SRC d
version (Posix) {
  version (DigitalMars) {
  } else version (LDC) {
  } else version (GNU) {
  } else {
    static assert (0, "Unsupported D compiler");
  }
} else {
  static assert (0, "Unsupported D compiler");
}
#+END_SRC

** set configuration SET :configuration:

SEE NOTES on configuration hierarchy in spine.org

*** spine: configuration.txt SET
**** example

#+HEADER: :tangle "../views/configuration_example.txt"
#+HEADER: :noweb yes
#+BEGIN_SRC d
/+ obt - org-mode generated file +/
struct Cfg {
  string http_request_type        = "<<http_request_type>>";
  string http_host                = "<<http_host>>";
  string www_url_doc_root         = "<<www_url_doc_root>>";
  string www_url_doc_subroot      = "<<www_url_doc_subroot>>";
  string processing_path_doc_root = "<<processing_path_doc_root>>";
  string cgi_bin_root             = "<<cgi_bin_root>>";
  string cgi_bin_subpath          = "<<cgi_bin_subpath>>";
  string cgi_filename             = "<<cgi_filename>>";
  string cgi_url_root             = "<<http_request_type>>://<<http_host>><<cgi_bin_subpath>>";
  string cgi_port                 = "";
  string cgi_user                 = "";
  string cgi_url_action           = "<<http_request_type>>://<<http_host>><<cgi_bin_subpath>>/<<cgi_filename>>";
  string cgi_search_form_title    = "<<cgi_search_form_title>>";
  string db_sqlite_path           = "<<db_sqlite_path>>";
  string db_sqlite_filename       = "<<db_sqlite_filename>>";
  string default_language         = "en";
  string default_papersize        = "a4,letter.portrait";
  string default_text_wrap        = "80";
  string default_hash_digest      = "sha256";
}
enum _cfg = Cfg();
#+END_SRC

**** configure

#+HEADER: :tangle ../views/configuration.txt_
#+HEADER: :noweb yes
#+BEGIN_SRC d
<<config_localhost>>
#+END_SRC

**** configure remote host (sisudoc.org)

#+NAME: config_remotehost
#+HEADER: :tangle ../views/configuration.txt_remotehost_
#+BEGIN_SRC d
struct Cfg {
  string http_request_type        = "https";
  string http_host                = "sisudoc.org";
  string www_url_doc_root         = "https://sisudoc.org";
  string www_url_doc_subroot      = "/spine";
  string processing_path_doc_root = "/srv/www/spine";
  string cgi_bin_root             = "/var/www/cgi/cgi-bin";
  string cgi_bin_subpath          = "";
  string cgi_filename             = "spine_search";
  string cgi_url_root             = "https://sisudoc.org";
  string cgi_port                 = "";
  string cgi_user                 = "";
  string cgi_url_action           = "https://sisudoc.org/spine_search";
  string cgi_search_form_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

**** configure localhost

#+NAME: config_localhost
#+HEADER: :tangle ../views/configuration.txt_localhost_
#+BEGIN_SRC d
struct Cfg {
  string http_request_type        = "http";
  string http_host                = "localhost";
  string www_url_doc_root         = "http://localhost";
  string www_url_doc_subroot      = "/spine";
  string processing_path_doc_root = "/srv/www/spine";
  string cgi_bin_root             = "/var/www/cgi/cgi-bin";
  string cgi_bin_subpath          = "/cgi-bin";
  string cgi_filename             = "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_search_form_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,letter.portrait";
  string default_text_wrap        = "80";
  string default_hash_digest      = "sha256";
}
enum _cfg = Cfg();
#+END_SRC

*** shared settings SET defaults

#+NAME: http_request_type
#+BEGIN_SRC sh
http
#+END_SRC

#+NAME: http_host
#+BEGIN_SRC sh
localhost
#+END_SRC

#+NAME: www_url_doc_root
#+BEGIN_SRC sh
http://localhost
#+END_SRC

#+NAME: www_url_doc_subroot
#+BEGIN_SRC sh
/spine
#+END_SRC

#+NAME: processing_path_doc_root
#+BEGIN_SRC sh
/srv/www/spine
#+END_SRC

#+NAME: www_doc_subroot
#+BEGIN_SRC sh
/spine
#+END_SRC

#+NAME: cgi_bin_root
#+BEGIN_SRC sh
/var/www/cgi/cgi-bin
#+END_SRC

#+NAME: db_sqlite_path
#+BEGIN_SRC sh
/var/www/sqlite
#+END_SRC

#+NAME: cgi_filename
#+BEGIN_SRC sh
spine_search
#+END_SRC

#+NAME: cgi_bin_subpath
#+BEGIN_SRC sh
/cgi-bin
#+END_SRC

#+NAME: cgi_search_form_title
#+BEGIN_SRC sh
≅ SiSU Spine search ፨
#+END_SRC

#+NAME: db_sqlite_filename
#+BEGIN_SRC sh
spine.search.db
#+END_SRC