You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

134 lines
4.5 KiB

  1. .. image:: https://img.shields.io/badge/licence-GPL--3-blue.svg
  2. :target: http://www.gnu.org/licenses/gpl-3.0-standalone.html
  3. :alt: License: GPL-3
  4. ==================
  5. server environment
  6. ==================
  7. This module provides a way to define an environment in the main Odoo
  8. configuration file and to read some configurations from files
  9. depending on the configured environment: you define the environment in
  10. the main configuration file, and the values for the various possible
  11. environments are stored in the `server_environment_files` companion
  12. module.
  13. All the settings will be read only and visible under the Configuration
  14. menu. If you are not in the 'dev' environment you will not be able to
  15. see the values contained in the defined secret keys
  16. (by default : '*passw*', '*key*', '*secret*' and '*token*').
  17. Installation
  18. ============
  19. By itself, this module does little. See for instance the
  20. `mail_environment` addon which depends on this one to allow configuring
  21. the incoming and outgoing mail servers depending on the environment.
  22. To install this module, you need to provide a companion module called
  23. `server_environment_files`. You can copy and customize the provided
  24. `server_environment_files_sample` module for this purpose.
  25. Configuration
  26. =============
  27. To configure this module, you need to edit the main configuration file
  28. of your instance, and add a directive called `running_env`. Commonly
  29. used values are 'dev', 'test', 'production'::
  30. [options]
  31. running_env=dev
  32. You should then edit the settings you need in the
  33. `server_environment_files` addon. The
  34. `server_environment_files_sample` can be used as an example:
  35. * values common to all / most environments can be stored in the
  36. `default/` directory using the .ini file syntax;
  37. * each environment you need to define is stored in its own directory
  38. and can override or extend default values;
  39. * finally, you can override or extend values in the main configuration
  40. file of you instance.
  41. Values associated to keys
  42. containing 'passw' are only displayed in the 'dev' environment.
  43. Usage
  44. =====
  45. To use this module, in your code, you can follow this example::
  46. from openerp.addons.server_environment import serv_config
  47. for key, value in serv_config.items('external_service.ftp'):
  48. print (key, value)
  49. serv_config.get('external_service.ftp', 'tls')
  50. .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
  51. :alt: Try me on Runbot
  52. :target: https://runbot.odoo-community.org/runbot/149/9.0
  53. Known issues / Roadmap
  54. ======================
  55. * it is not possible to set the environment from the command line. A
  56. configuration file must be used.
  57. * the module does not allow to set low level attributes such as database server, etc.
  58. * do not add a ``static`` directory to this addon nor any ``OCA/server-tool`` module that
  59. depend on it so its not imported unless installed in a database; doing so would
  60. break installations where ``OCA/server-tools`` is in the ``addons-path`` but not
  61. otherwise used, due to the absence of a ``server_environement_files`` addon.
  62. Bug Tracker
  63. ===========
  64. Bugs are tracked on `GitHub Issues
  65. <https://github.com/OCA/server-tools/issues>`_. In case of trouble, please
  66. check there if your issue has already been reported. If you spotted it first,
  67. help us smashing it by providing a detailed and welcomed `feedback
  68. <https://github.com/OCA/
  69. server-tools/issues/new?body=module:%20
  70. server_environment%0Aversion:%20
  71. 9.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
  72. Credits
  73. =======
  74. Images
  75. ------
  76. * Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
  77. Contributors
  78. ------------
  79. * Alexandre Fayolle <alexandre.fayolle@camptocamp.com>
  80. * Daniel Reis <dgreis@sapo.pt>
  81. * Florent Xicluna <florent.xicluna@gmail.com>
  82. * Guewen Baconnier <guewen.baconnier@camptocamp.com>
  83. * Holger Brunn <hbrunn@therp.nl>
  84. * Joël Grand-Guillaume <joel.grandguillaume@camptocamp.com>
  85. * Nicolas Bessi <nicolas.bessi@camptocamp.com>
  86. * Wingo
  87. * Yannick Vaucher <yannick.vaucher@camptocamp.com>
  88. Maintainer
  89. ----------
  90. .. image:: https://odoo-community.org/logo.png
  91. :alt: Odoo Community Association
  92. :target: https://odoo-community.org
  93. This module is maintained by the OCA.
  94. OCA, or the Odoo Community Association, is a nonprofit organization whose
  95. mission is to support the collaborative development of Odoo features and
  96. promote its widespread use.
  97. To contribute to this module, please visit https://odoo-community.org.