home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #3 / amigamamagazinepolishissue1998.iso / bazy / config_server / doc / config-server.doc < prev    next >
Text File  |  1995-02-12  |  13KB  |  309 lines

  1. (Internal note: An HTML based version of this file will be written.  I'm
  2.  only medium-warm about AmigaGuide, compared with HTML, and if no good
  3.  HTML/WWW browser is written for the Amiga, I will eventually do one for my
  4.  tastes.  `Good' == Full support for v2.x of the Amiga OS, and independant
  5.  of the massive MUI junk that a known (but not-so-good) Amiga HTML browser
  6.  uses.  I have nothing against MUI, except that it's huge, even larger than
  7.  most applications that use it.  Worse, the first "requires MUI" program I
  8.  used was a _miniscule_ "login" program for muFS, a program which has
  9.  little reason for using _any_ GUI, much less the monstrous MUI.
  10.  
  11.  Suffice to say I'm massively turned off on MUI.  (^&
  12.  
  13.  (ramble) )
  14.  
  15.  
  16. Config-server uses/maintains a configuration database.
  17.  
  18. General copyright, disclaimer, license:
  19.     The general "legal.doc" file applies, EXCEPT with regard to modifying
  20.     config-server:
  21.  
  22.     As far as customization of config-server is concerned...  I don't
  23.     object to your customizing it for your needs.  However, since the vain
  24.     hope is that config-server can act as a "standard" configuration tool,
  25.     I ask that no one else use the "config-server" name for a message port
  26.     or software program/title.  If you do a better job of writing a similar
  27.     tool, then we can all unmistakably migrate to that; if you don't
  28.     materially improve things, it would be a bad idea for us to step on one
  29.     anothers' toes, obviously.
  30.  
  31. A sample config-server database is provided (env/config-server.config).
  32. Copy this to env: and envarc: on your system before starting config-server.
  33. The sample entries show some of the flexibility of config-server.  The
  34. entries for Indra's Net tools (IndraSMTPd, etc.) are quasi-real.  Something
  35. like each will be used my my Indra's Net pieces (beads? nodes?), but as the
  36. sample config file was written before the pieces/beads/nodes were ready to
  37. use config-server, the names were just "tossed out".  Now that I have a
  38. servicable config-editor for config-server, I am ready to begin making the
  39. pieces of software _use_ config-server, and the names of some of the tags
  40. may change...  Regardless, the sample database gives you some idea of how
  41. config-server can be used.
  42.  
  43. On-disk, the database has the form of lines of text.  Due to a flaw of
  44. ARexx, lines cannot exceed 1000 characters in length.  The format of the
  45. lines is:
  46.     <application>:<encoding>:<tag>:<value>
  47.  
  48.  ** <application> is the name of a program that is at issue.  An "umbrella"
  49.     configuration set may be explicitly used by applications.  E.g., if I
  50.     write a suite of programs to send and receive Internet mail and Usenet
  51.     news, many of the configuration options may be the same...but some
  52.     application-specific details may vary (or I may wish to turn up the
  53.     log-detail on ONE of the programs without affecting the others).
  54.  
  55.  ** <encoding> indicates the way in which the <value> data is encoded.
  56.     There are several encoding forms:
  57.  
  58.         text        Plain ASCII.
  59.         hex         Hexadecimal rep. of the raw data.
  60.         env         Global ENV: var.
  61.         var         Private Shell var.
  62.         file        Specified file.
  63.         cliplist    A member of the ARexx cliplist is indicated.
  64.         command     A command who's output to capture.
  65.  
  66.     ...NOTE that Shell "private" variables are of limited value when you
  67.     have config-server evaluate them.  In fact, I can think of NO practical
  68.     value for having config-server do so, since config-server, written in
  69.     ARexx, cannot meaningfully use Shell variables.  HOWEVER, they serve as
  70.     place-holders so that single- and double-asterisk prefixed versions
  71.     (*var, **var) will be standard.
  72.  
  73.     Use a single asterisk prefix (*var, *command, etc.), if you want the
  74.     <encoding> to pass through to the application (this may be useful for
  75.     expressions or local shell variables).
  76.  
  77.     Use a double-asterisk prefix (**var, **command, etc.) for encodings
  78.     that you wish to be evaluated EACH TIME THE VALUE IS USED.  This may be
  79.     useful if you wish to include a "fortune cookie" message in a
  80.     signature, for example, and so you wish the application to run the
  81.     program for every message you write.
  82.  
  83.     If you wish to use a custom format, I would suggest a triple-asterisk
  84.     (***) prefix.  Such an encoding may mean anything you wish it to mean.
  85.  
  86.     config-server reserves the right to add new encoding types, and to
  87.     expect the "standard" single- and double-asterisk prefixes to be safely
  88.     applicable to all of them, with the standard meaning.  Unknown
  89.     encoding types that don't begin with at least one asterisk for a prefix
  90.     will have extra "junk" tacked onto the front -- this will render such
  91.     encodings useless, and will hopefully discourage anyone planning such.
  92.  
  93.  
  94.  ** <tag> is an indication of the interpretation of the included data in
  95.     the database.  The definition and interpretation of most <tag>'s will
  96.     be up to the application.  Several standard <tag>s are defined:
  97.  
  98.         comment    used for user-info
  99.         comments   (internal)
  100.         version    used for knowing which version of software last run
  101.  
  102.     Enumerated tags (i.e., when you are talking about JUST ONE PARTICULAR
  103.     instance of a tag) should end with .<N> where <N> is the numbered
  104.     version you are interested in.  (All tags are implicitly numbered; if
  105.     you don't enumerate a tag, then the config-server will "work at the
  106.     end" (creating a new highest-<N>, or returning the current highest-<N>,
  107.     as the case may be).
  108.  
  109.     Pluralized tags (i.e., where you want to talk about ALL of the tags at
  110.     once -- normally to retrieve a count of how many tags are available)
  111.     always end with a 'S.  (E.g., COMMENT'S or SIGNATURE'S.)
  112.  
  113.     Each "standard <tag>" will NOT begin with an asterisk (*) to avoid
  114.     trompling, and being trompled by, application-specific <tag>'s. This
  115.     also means that application-specific <tag>'s MUST start with asterisks.
  116.  
  117.  ** <value> is the information that, when decoding by the config-server
  118.     according to the <encoding> will provide the raw data that the
  119.     application is looking for.
  120.  
  121. General usage:
  122.     Use ADDATTR <app>':'<enc>':'<tag>':'<val> to add a quadruple.
  123.  
  124.     Use GETATTR APPS to get a colon-delimited list of applications.
  125.         (Prefix of 'TEXT' (encoding) + ':' is added.)
  126.  
  127.     Use GETATTR TAGS <app> to get a colon-delimited tag-list for <app>.
  128.         (Prefix of 'TEXT' (encoding) + ':' is added.)
  129.  
  130.     Use GETATTR TAG <app>':'<tag> to get the "raw" <value> of a tag.
  131.         (result: <encoding>':'<value>; <encoding> is never resolved for
  132.          you.)
  133.  
  134.         (NOTE: if you use a 'S suffix on the <tag>, you should be told the
  135.          number of times that the "base" <tag> occurs.  E.g., if you ask
  136.          for "my-app:comment's", you will be told how many COMMENT tags
  137.          occur for MY-APP.  This value MAY BE a null-string ('') if no
  138.          occurances of the given <tag> exist.)
  139.  
  140.         (NOTE: If you use a .<n> suffix on the <tag>, you will be given the
  141.          Nth occurance of that tag for the <app>.  E.g., if you ask for
  142.          "my-app:comment.1" you will be given the first COMMENT.)
  143.  
  144.         (NOTE: If you give no .<n> NOR 'S suffix, the config-server will
  145.          first try adding a 'S to the end to get an occurance-count, then
  146.          will use a .<count> to return the LAST occurance of that config
  147.          tag.  E.g., if you ask for 'my-app:comment', you will be given the
  148.          _last_ COMMENT in the database for MY-APP.
  149.  
  150.     Use GETATTR VAL <app>':'<tag> to get the "real" <value>.
  151.         (SEE result: and NOTE:'s for GETATTR TAG, above.)
  152.  
  153.     Use HELP to get a help-string.
  154.  
  155.     Use QUIT to cause the config-server to exit.
  156.  
  157.     Use RELOAD to cause config-server to re-read the config file.
  158.         (Aliases: NEW, CLEAR, OPEN (allow OPEN to read an alternative
  159.          config?)
  160.  
  161.     Use REMATTR to cause config-server to remove an <app> or a <tag>.
  162.         (If <tag> is pluralized, then all instances of <tag> are removed.)
  163.  
  164.         (If <tag> has a .<N> form, then that <tag>-instance is removed, and
  165.          other instances of that <tag> are moved down by one.)
  166.  
  167.         (If <tag> is neither pluralized ('S) nor enumerated (.<N>), then
  168.          a default enumeration of the LAST instance of <tag> is used.)
  169.  
  170.     Use SAVE to cause config-server to save its database.
  171.  
  172. Results:
  173.     All commands return results of some sort, unless there was an error
  174.     (and some return success/failure indicators in RESULT rather than an
  175.     error-code/-level in RC).
  176.  
  177.     RESULT strings generally have the form:
  178.  
  179.         <encoding>:<rest>
  180.  
  181.     ...however, this format isn't always appropriate (e.g., in a GETATTR
  182.     TAG command, the format should always be presentable as TEXT:, and an
  183.     "inner encoding" is given anyway.
  184.  
  185.     I'm interested in comments on this.
  186.  
  187.     Generally, this is a moot point; you will be interested in the results
  188.     of a GETATTR, whose format is assured to be in this format already.
  189.  
  190. RESTRICTIONS:
  191.     Restrictions can be divided into two sets: Those intrinsic to the way
  192.     the config-server config data file and ARexx commands are parsed, and
  193.     those that are to avoid undue bother for end-users. The latter may be
  194.     because a user may opt to edit a file with a text editor (which may
  195.     freely convert between TAB's and SPACE's and/or truncate trailing
  196.     spaces on lines, for example), or it may be something which, if you
  197.     manage to make it work, may prove difficult to maintain, and which I
  198.     may not expend great effort ensuring continued support for.
  199.  
  200.     Intrinsic limitations are:
  201.      ** The <value> data can be DEcoded to contain essentially anything
  202.         that will fit in an ARexx string for returning to the caller. The
  203.         ENcoded version (which is the same as the decoded, for "text"
  204.         <encoding>'s) cannot contain EOL's.  If fields are not "plain
  205.         text", or need to include colons or EOL's, then the fields should
  206.         be encoded as hex, or indirected through a file.
  207.  
  208.      ** <tag> values should not contain dots (.), apostrophes ('), colons
  209.         (:), or EOL's.
  210.  
  211.      ** The other fields must not contain EOL's or colons.
  212.  
  213.     To be nice to users (and/or yourself):
  214.      ** Except for the <value> string, embeded, leading, and trailing
  215.         spaces are strongly discouraged (but it's possible they may work,
  216.         if you are very careful).
  217.  
  218.      ** In <value> strings, if you use spaces to delimit sub-fields (as
  219.         opposed to actually considering spaces as intrinsic components of
  220.         the data), try to be liberal in your definition of "space". A
  221.         "space" may be a single ASCII <Space> character (hex code 20), or
  222.         it maybe a <Tab> (09), or 5 <Tab>'s, 3 <Space>'s, and another
  223.         <Tab>.
  224.  
  225.      ** Use of control-characters other than the ASCII LineFeed (EOL) is
  226.         permitted in any field, but probably is a bad idea.
  227.  
  228. Global variable worth noting (of interest ONLY to people who want to
  229. modify config-server's behavior):
  230.     CONFIG_FILE
  231.         Contains the name (sans path) of the file to use for
  232.         config-server's database.  'ENV:' is prefixed onto the name for
  233.         READING.  Both 'ENV:' and 'ENVARC:' are prefixed onto the name for
  234.         WRITING.
  235.  
  236.         (NOTE: Suggest a better place for this file than ENV:/ENVARC:?)
  237.  
  238.         This is used for readingand writing the database file, and so is
  239.         only needed by a couple of functions.
  240.  
  241.     CONFIGS.
  242.      ** This root/stem variable holds the database in-memory.  This is used
  243.         extensively.
  244.  
  245.  
  246.      ** It is organized like so:
  247.  
  248.             CONFIGS.<app>':'<tag>
  249.  
  250.         ...where <app> and <tag> are forced to upper-case to avoid
  251.         case-sensitivity problems.  (Trying to be case-aware for this, in
  252.         ARexx, is difficult...for this, and other reasons, I may re-write
  253.         config-server in C eventually.)
  254.  
  255.         <app>':'<tag> can be considered, together, as an <app-tag>
  256.  
  257.  
  258.      ** To determine all app's available available, use the <app-tag> for
  259.         'config-server:applications'.  This will return:
  260.  
  261.             <encoding>':'<tag-list>
  262.  
  263.         As with all other automatically maitained and generated tag sets,
  264.         the <encoding> for `config-server:applications' will always be
  265.         `TEXT', so you may strip off the `TEXT:' prefix and use the value
  266.         directly.
  267.  
  268.         You may then use the resulting <tag-list>, parsing by colons, to
  269.         get each app-name.
  270.  
  271.         (Note, this duplicates the GETATTR APPS command.)
  272.  
  273.  
  274.      ** To get a list of tags for a given application, you use the app-tag
  275.         of:
  276.  
  277.             <app>":TAG'S"
  278.  
  279.         ...which will return:
  280.  
  281.             "TEXT:"<tag-list>
  282.  
  283.         You can then parse <tag-list> as a colon-delimited field.
  284.  
  285.         (Note, this duplicates the GETATTR TAGS command.)
  286.  
  287.  
  288.      ** To get the "raw" value of a config entry (e.g., the filename or
  289.         env-var-name that the config-server keeps track of internally), use
  290.         the app-tag of:
  291.  
  292.             <app>':'<tag>'.'<N>
  293.  
  294.         ...where <N> is the occurance-number you want to access (each tag
  295.         may appear any number of times).  To find out how many time's a
  296.         given <tag> occurs for a given <app>, use:
  297.  
  298.             <app>':'<tag>"'S"
  299.  
  300.         ...these return
  301.  
  302.             <encoding>':'<tag-list>
  303.             'TEXT:'<count>
  304.  
  305.         ...repsectively.
  306.  
  307.         (Note, these duplicate GETATTR TAG more or less.)
  308.  
  309.