From ccccfbc8383c6aa6d52949ee9e9675bd7d3f068c Mon Sep 17 00:00:00 2001 From: Stefano Zacchiroli Date: Thu, 20 May 2004 16:30:32 +0000 Subject: [PATCH] Changed mapping keys <-> environment variables, mixed case envvars are now used. --- helm/ocaml/registry/helm_registry.ml | 6 ++---- helm/ocaml/registry/helm_registry.mli | 5 ++--- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/helm/ocaml/registry/helm_registry.ml b/helm/ocaml/registry/helm_registry.ml index 10639e089..a5e1d6e1a 100644 --- a/helm/ocaml/registry/helm_registry.ml +++ b/helm/ocaml/registry/helm_registry.ml @@ -86,9 +86,8 @@ let restore_registry backup = (* as \\w but: * - no sequences of '_' longer than 1 are permitted - * - no uppercase letter are permitted *) -let valid_step_rex_raw = "[a-z0-9]+\\(_[a-z0-9]+\\)*" +let valid_step_rex_raw = "[a-zA-Z0-9]+\\(_[a-z0A-Z-9]+\\)*" let valid_key_rex_raw = sprintf "%s\(\\.%s\)*" valid_step_rex_raw valid_step_rex_raw let valid_key_rex = Str.regexp ("^" ^ valid_key_rex_raw ^ "$") @@ -127,8 +126,7 @@ let set' registry ~key ~value = let unset = Hashtbl.remove registry -let env_var_of_key key = - Str.global_replace dot_rex "__" (String.uppercase key) +let env_var_of_key = Str.global_replace dot_rex "__" let get key = let rec aux stack key = diff --git a/helm/ocaml/registry/helm_registry.mli b/helm/ocaml/registry/helm_registry.mli index 7b7ef874f..0f13a6162 100644 --- a/helm/ocaml/registry/helm_registry.mli +++ b/helm/ocaml/registry/helm_registry.mli @@ -29,7 +29,7 @@ * * key ::= path * path ::= component ( '.' component )* - * component ::= ( lowercase_alpha | num | '_' )+ + * component ::= ( alpha | num | '_' )+ * # with the only exception that sequences of '_' longer than 1 aren't valid * # components * @@ -51,9 +51,8 @@ * a configuration file (via "save_to" function below) . * * Mapping between keys and environment variables is as follows: - * - the whole key is uppercased * - each "." is converted to "__" - * E.g.: my.foo_ish.application -> MY__FOO_ISH__APPLICATION + * E.g.: my.Foo_iSH.Application -> my__Foo_iSH__Application * * ++ Variable interpolation ++ * -- 2.39.2