[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
artanis.conf user defined variables
From: |
Mortimer Cladwell |
Subject: |
artanis.conf user defined variables |
Date: |
Fri, 10 Dec 2021 17:10:09 -0500 |
Hi Nala,
My artanis app makes use of a custom variable, let's call it "maxnumwidgets", that I would like to include in artanis.conf to give the users an easy way to configure. Currently I do this by modifying the source during install with the following snippet in the guix packaging recipe:
(substitute* "artanis/config.scm"
((" \\(else \\(error parse-namespace-cache \"Config: Invalid item\" item\\)\\)\\)\\)")
"(else (error parse-namespace-cache \"Config: Invalid item\" item))))\n\n(define (parse-namespace-cookie item)\n (match item\n (('expire expire) (conf-set! '(cookie expire) (->integer expire)))\n (('maxnumwidgets maxnumwidgets) (conf-set! '(cookie maxnumwidgets) (->integer maxnumwidgets)))\n (else (error parse-namespace-cookie \"Config: Invalid item\" item))))"))
maxnumwidgets is not a cookie. I put it in the cookie group for convenience. I can imagine an artanis.conf section that looks like:
##user defined variables
##user.var1 = <string>
##user.var2 = <string>
##user.var3 = <string>
##user.var4 = <integer>
##user.var5 = <integer>
##user.var6 = <integer>
This would provide the developer with a few configurable variables that don't require modification of the source code. The developer would have to document the meaning of each variable, for example I would have to indicate in documentation that user.var1 == maxnumwidgets. I can write the source modifications and create a pull request, but don't want to put in the effort unless you are interested. Let me know.
Thanks
Mortimer
- artanis.conf user defined variables,
Mortimer Cladwell <=