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.

126 lines
4.0 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/10.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. Bug Tracker
  59. ===========
  60. Bugs are tracked on `GitHub Issues
  61. <https://github.com/OCA/server-tools/issues>`_. In case of trouble, please
  62. check there if your issue has already been reported. If you spotted it first,
  63. help us smashing it by providing a detailed and welcomed feedback.
  64. Credits
  65. =======
  66. Images
  67. ------
  68. * Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
  69. Contributors
  70. ------------
  71. * Alexandre Fayolle <alexandre.fayolle@camptocamp.com>
  72. * Daniel Reis <dgreis@sapo.pt>
  73. * Florent Xicluna <florent.xicluna@gmail.com>
  74. * Guewen Baconnier <guewen.baconnier@camptocamp.com>
  75. * Holger Brunn <hbrunn@therp.nl>
  76. * Joël Grand-Guillaume <joel.grandguillaume@camptocamp.com>
  77. * Nicolas Bessi <nicolas.bessi@camptocamp.com>
  78. * Wingo
  79. * Yannick Vaucher <yannick.vaucher@camptocamp.com>
  80. Maintainer
  81. ----------
  82. .. image:: https://odoo-community.org/logo.png
  83. :alt: Odoo Community Association
  84. :target: https://odoo-community.org
  85. This module is maintained by the OCA.
  86. OCA, or the Odoo Community Association, is a nonprofit organization whose
  87. mission is to support the collaborative development of Odoo features and
  88. promote its widespread use.
  89. To contribute to this module, please visit https://odoo-community.org.