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.

125 lines
3.9 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 keys named '*passw*'.
  16. Installation
  17. ============
  18. By itself, this module does little. See for instance the
  19. `mail_environment` addon which depends on this one to allow configuring
  20. the incoming and outgoing mail servers depending on the environment.
  21. To install this module, you need to provide a companion module called
  22. `server_environment_files`. You can copy and customize the provided
  23. `server_environment_files_sample` module for this purpose.
  24. Configuration
  25. =============
  26. To configure this module, you need to edit the main configuration file
  27. of your instance, and add a directive called `running_env`. Commonly
  28. used values are 'dev', 'test', 'production'::
  29. [options]
  30. running_env=dev
  31. You should then edit the settings you need in the
  32. `server_environment_files` addon. The
  33. `server_environment_files_sample` can be used as an example:
  34. * values common to all / most environments can be stored in the
  35. `default/` directory using the .ini file syntax;
  36. * each environment you need to define is stored in its own directory
  37. and can override or extend default values;
  38. * finally, you can override or extend values in the main configuration
  39. file of you instance.
  40. Values associated to keys
  41. containing 'passw' are only displayed in the 'dev' environment.
  42. Usage
  43. =====
  44. To use this module, in your code, you can follow this example::
  45. from openerp.addons.server_environment import serv_config
  46. for key, value in serv_config.items('external_service.ftp'):
  47. print (key, value)
  48. serv_config.get('external_service.ftp', 'tls')
  49. .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
  50. :alt: Try me on Runbot
  51. :target: https://runbot.odoo-community.org/runbot/149/10.0
  52. Known issues / Roadmap
  53. ======================
  54. * it is not possible to set the environment from the command line. A
  55. configuration file must be used.
  56. * the module does not allow to set low level attributes such as database server, etc.
  57. Bug Tracker
  58. ===========
  59. Bugs are tracked on `GitHub Issues
  60. <https://github.com/OCA/server-tools/issues>`_. In case of trouble, please
  61. check there if your issue has already been reported. If you spotted it first,
  62. help us smashing it by providing a detailed and welcomed feedback.
  63. Credits
  64. =======
  65. Images
  66. ------
  67. * Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
  68. Contributors
  69. ------------
  70. * Alexandre Fayolle <alexandre.fayolle@camptocamp.com>
  71. * Daniel Reis <dgreis@sapo.pt>
  72. * Florent Xicluna <florent.xicluna@gmail.com>
  73. * Guewen Baconnier <guewen.baconnier@camptocamp.com>
  74. * Holger Brunn <hbrunn@therp.nl>
  75. * Joël Grand-Guillaume <joel.grandguillaume@camptocamp.com>
  76. * Nicolas Bessi <nicolas.bessi@camptocamp.com>
  77. * Wingo
  78. * Yannick Vaucher <yannick.vaucher@camptocamp.com>
  79. Maintainer
  80. ----------
  81. .. image:: https://odoo-community.org/logo.png
  82. :alt: Odoo Community Association
  83. :target: https://odoo-community.org
  84. This module is maintained by the OCA.
  85. OCA, or the Odoo Community Association, is a nonprofit organization whose
  86. mission is to support the collaborative development of Odoo features and
  87. promote its widespread use.
  88. To contribute to this module, please visit https://odoo-community.org.