config_panel.toml.example 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. #:schema https://github.com/YunoHost/apps/raw/main/schemas/config_panel.v1.schema.json
  2. ## Config panel are available from webadmin > Apps > YOUR_APP > Config Panel Button
  3. ## Those panels let user configure some params on their apps using a friendly interface,
  4. ## and remove the need to manually edit files from the command line.
  5. ## From a packager perspective, this .toml is coupled to the scripts/config script,
  6. ## which may be used to define custom getters/setters. However, most use cases
  7. ## should be covered automagically by the core, thus it may not be necessary
  8. ## to define a scripts/config at all!
  9. ## -----------------------------------------------------------------------------
  10. ## IMPORTANT: In accordance with YunoHost's spirit, please keep things simple and
  11. ## do not overwhelm the admin with tons of misunderstandable or advanced settings.
  12. ## -----------------------------------------------------------------------------
  13. ## The top level describe the entire config panels screen.
  14. ## The version is a required property.
  15. ## Here a small reminder to associate config panel version with YunoHost version
  16. ## | Config | YNH | Config panel small change log |
  17. ## | ------ | --- | ------------------------------------------------------- |
  18. ## | 0.1 | 3.x | 0.1 config script not compatible with YNH >= 4.3 |
  19. ## | 1.0 | 4.3.x | The new config panel system with 'bind' property |
  20. version = "1.0"
  21. ## (optional) i18n property let you internationalize questions, however this feature
  22. ## is only available in core configuration panel (like yunohost domain config).
  23. ## So in app config panel this key is ignored for now, but you can internationalize
  24. ## by using a lang dictionary (see property name bellow)
  25. # i18n = "prefix_translation_key"
  26. ################################################################################
  27. #### ABOUT PANELS
  28. ################################################################################
  29. ## The next level describes web admin panels
  30. ## You have to choose an ID for each panel, in this example the ID is "main"
  31. ## Keep in mind this ID will be used in CLI to refer to your question, so choose
  32. ## something short and meaningfull.
  33. ## In the webadmin, each panel corresponds to a distinct tab / form
  34. [main]
  35. ## Define the label for your panel
  36. ## Internationalization works similarly to the 'description' and 'ask' questions in the manifest
  37. # name.en = "Main configuration"
  38. # name.fr = "Configuration principale"
  39. ## (optional) If you need to trigger a service reload-or-restart after the user
  40. ## change a question in this panel, you can add your service in the list.
  41. services = ["__APP__"]
  42. # or services = ["nginx", "__APP__"] to also reload-or-restart nginx
  43. ## (optional) This help properties is a short help displayed on the same line
  44. ## than the panel title but not displayed in the tab.
  45. # help = ""
  46. ############################################################################
  47. #### ABOUT SECTIONS
  48. ############################################################################
  49. ## A panel is composed of one or several sections.
  50. ##
  51. ## Sections are meant to group questions together when they correspond to
  52. ## a same subtopic. This impacts the rendering in terms of CLI prompts
  53. ## and HTML forms
  54. ##
  55. ## You should choose an ID for your section, and prefix it with the panel ID
  56. ## (Be sure to not make a typo in the panel ID, which would implicitly create
  57. ## an other entire panel)
  58. ##
  59. ## We use the context of pepettes_ynh as an example,
  60. ## which is a simple donation form app written in python,
  61. ## and for which the admin will want to edit the configuration
  62. [main.customization]
  63. ## (optional) Defining a proper title for sections is not mandatory
  64. ## and depends on the exact rendering you're aiming for the CLI / webadmin
  65. name = ""
  66. ## (optional) This help properties is a short help displayed on the same line
  67. ## than the section title, meant to provide additional details
  68. # help = ""
  69. ## (optional) As for panel, you can specify to trigger a service
  70. ## reload-or-restart after the user change a question in this section.
  71. ## This property is added to the panel property, it doesn't deactivate it.
  72. ## So no need to replicate, the service list from panel services property.
  73. # services = []
  74. ## (optional) By default all questions are optionals, but you can specify a
  75. ## default behaviour for question in the section
  76. optional = false
  77. ## (optional) It's also possible with the 'visible' property to only
  78. ## display the section depending on the user's answers to previous questions.
  79. ##
  80. ## Be careful that the 'visible' property should only refer to **previous** questions
  81. ## Hence, it should not make sense to have a "visible" property on the very first section.
  82. ##
  83. ## Also, keep in mind that this feature only works in the webadmin and not in CLI
  84. ## (therefore a user could be prompted in CLI for a question that may not be relevant)
  85. # visible = true
  86. ########################################################################
  87. #### ABOUT QUESTIONS
  88. ########################################################################
  89. ## A section is compound of one or several questions.
  90. ## ---------------------------------------------------------------------
  91. ## IMPORTANT: as for panel and section you have to choose an ID, but this
  92. ## one should be unique in all this document, even if the question is in
  93. ## an other panel.
  94. ## ---------------------------------------------------------------------
  95. ## You can use same questions types and properties than in manifest.yml
  96. ## install part. However, in YNH 4.3, a lot of change has been made to
  97. ## extend availables questions types list.
  98. ## See: TODO DOC LINK
  99. [main.customization.project_name]
  100. ## (required) The ask property is equivalent to the ask property in
  101. ## the manifest. However, in config panels, questions are displayed on the
  102. ## left side and therefore have less space to be rendered. Therefore,
  103. ## it is better to use a short question, and use the "help" property to
  104. ## provide additional details if necessary.
  105. ask.en = "Name of the project"
  106. ## (required) The type property indicates how the question should be
  107. ## displayed, validated and managed. Some types have specific properties.
  108. ##
  109. ## Types available: string, boolean, number, range, text, password, path
  110. ## email, url, date, time, color, select, domain, user, tags, file.
  111. ##
  112. ## For a complete list with specific properties, see: TODO DOC LINK
  113. type = "string"
  114. ########################################################################
  115. #### ABOUT THE BIND PROPERTY
  116. ########################################################################
  117. ## (recommended) 'bind' property is a powerful feature that let you
  118. ## configure how and where the data will be read, validated and written.
  119. ## By default, 'bind property is in "settings" mode, it means it will
  120. ## **only** read and write the value in application settings file.
  121. ## bind = "settings"
  122. ## However, settings usually correspond to key/values in actual app configurations
  123. ## Hence, a more useful mode is to have bind = ":FILENAME". In that case, YunoHost
  124. ## will automagically find a line with "KEY=VALUE" in FILENAME
  125. ## (with the adequate separator between KEY and VALUE)
  126. ##
  127. ## YunoHost will then use this value for the read/get operation.
  128. ## During write/set operations, YunoHost will overwrite the value
  129. ## in **both** FILENAME and in the app's settings.yml
  130. ## Configuration file format supported: yaml, toml, json, ini, env, php,
  131. ## python. The feature probably works with others formats, but should be tested carefully.
  132. ## Note that this feature only works with relatively simple cases
  133. ## such as `KEY: VALUE`, but won't properly work with
  134. ## complex data structures like multilin array/lists or dictionnaries.
  135. ## It also doesn't work with XML format, custom config function call, php define(), ...
  136. ## More info on TODO
  137. # bind = ":/var/www/__APP__/settings.py"
  138. ## By default, bind = ":FILENAME" will use the question ID as KEY
  139. ## ... but the question ID may sometime not be the exact KEY name in the configuration file.
  140. ##
  141. ## In particular, in pepettes, the python variable is 'name' and not 'project_name'
  142. ## (c.f. https://github.com/YunoHost-Apps/pepettes_ynh/blob/5cc2d3ffd6529cc7356ff93af92dbb6785c3ab9a/conf/settings.py##L11 )
  143. ##
  144. ## In that case, the key name can be specified before the column ':'
  145. bind = "name:/var/www/__APP__/settings.py"
  146. ## ---------------------------------------------------------------------
  147. ## IMPORTANT: other 'bind' mode exists:
  148. ##
  149. ## bind = "FILENAME" (with no column character before FILENAME)
  150. ## may be used to bind to the **entire file content** (instead of a single KEY/VALUE)
  151. ## This could be used to expose an entire configuration file, or binary files such as images
  152. ## For example:
  153. ## bind = "/var/www/__APP__/img/logo.png"
  154. ##
  155. ## bind = "null" can be used to disable reading / writing in settings.
  156. ## This creates sort of a "virtual" or "ephemeral" question which is not related to any actual setting
  157. ## In this mode, you are expected to define custom getter/setters/validators in scripts/config:
  158. ##
  159. ## getter: get__QUESTIONID()
  160. ## setter: set__QUESTIONID()
  161. ## validator: validate__QUESTIONID()
  162. ##
  163. ## You can also specify a common getter / setter / validator, with the
  164. ## function 'bind' mode, for example here it will try to run
  165. ## get__array_settings() first.
  166. # bind = "array_settings()"
  167. ## ---------------------------------------------------------------------
  168. ## ---------------------------------------------------------------------
  169. ## IMPORTANT: with the exception of bind=null questions,
  170. ## question IDs should almost **always** correspond to an app setting
  171. ## initialized / reused during install/upgrade.
  172. ## Not doing so may result in inconsistencies between the config panel mechanism
  173. ## and the use of ynh_add_config
  174. ## ---------------------------------------------------------------------
  175. ########################################################################
  176. #### OTHER GENERIC PROPERTY FOR QUESTIONS
  177. ########################################################################
  178. ## (optional) An help text for the question
  179. help = "Fill the name of the project which will received donation"
  180. ## (optional) An example display as placeholder in web form
  181. # example = "YunoHost"
  182. ## (optional) set to true in order to redact the value in operation logs
  183. # redact = false
  184. ## (optional) for boolean questions you can specify replacement values
  185. ## bound to true and false, in case property is bound to config file
  186. # useful if bound property in config file expects something else than integer 1
  187. yes = "Enable"
  188. # useful if bound property in config file expects something else than integer 0
  189. no = "Disable"
  190. ## (optional) A validation pattern
  191. ## ---------------------------------------------------------------------
  192. ## IMPORTANT: your pattern should be between simple quote, not double.
  193. ## ---------------------------------------------------------------------
  194. pattern.regexp = '^\w{3,30}$'
  195. pattern.error = "The name should be at least 3 chars and less than 30 chars. Alphanumeric chars are accepted"
  196. ## Note: visible and optional properties are also available for questions
  197. [main.customization.contact_url]
  198. ask = "Contact url"
  199. type = "url"
  200. example = "mailto: contact@example.org"
  201. help = "mailto: accepted"
  202. pattern.regexp = '^mailto:[^@]+@[^@]+|https://$'
  203. pattern.error = "Should be https or mailto:"
  204. bind = ":/var/www/__APP__/settings.py"
  205. [main.customization.logo]
  206. ask = "Logo"
  207. type = "file"
  208. accept = ".png"
  209. help = "Fill with an already resized logo"
  210. bind = "__INSTALL_DIR__/img/logo.png"
  211. [main.customization.favicon]
  212. ask = "Favicon"
  213. type = "file"
  214. accept = ".png"
  215. help = "Fill with an already sized favicon"
  216. bind = "__INSTALL_DIR__/img/favicon.png"
  217. [main.stripe]
  218. name = "Stripe general info"
  219. optional = false
  220. # The next alert is overwrited with a getter from the config script
  221. [main.stripe.amount]
  222. ask = "Donation in the month : XX €
  223. type = "alert"
  224. style = "success"
  225. [main.stripe.publishable_key]
  226. ask = "Publishable key"
  227. type = "string"
  228. redact = true
  229. help = "Indicate here the stripe publishable key"
  230. bind = ":/var/www/__APP__/settings.py"
  231. [main.stripe.secret_key]
  232. ask = "Secret key"
  233. type = "string"
  234. redact = true
  235. help = "Indicate here the stripe secret key"
  236. bind = ":/var/www/__APP__/settings.py"
  237. [main.stripe.prices]
  238. ask = "Prices ID"
  239. type = "tags"
  240. help = """\
  241. Indicates here the prices ID of donation products you created in stripe interfaces. \
  242. Go on [Stripe products](https://dashboard.stripe.com/products) to create those donation products. \
  243. Fill it tag with 'FREQUENCY/CURRENCY/PRICE_ID' \
  244. FREQUENCY: 'one_time' or 'recuring' \
  245. CURRENCY: 'EUR' or 'USD' \
  246. PRICE_ID: ID from stripe interfaces starting with 'price_' \
  247. """
  248. pattern.regexp = '^(one_time|recuring)/(EUR|USD)/price_.*$'
  249. pattern.error = "Please respect the format describe in help text for each price ID"