Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
odoo-addon-server-environment
Advanced tools
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:ae28dad14e2e78049ad0bf61b612d31aef7ffc04f44fb559c32142e2ad05eea1 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png :target: https://odoo-community.org/page/development-status :alt: Production/Stable .. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html :alt: License: LGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--env-lightgray.png?logo=github :target: https://github.com/OCA/server-env/tree/18.0/server_environment :alt: OCA/server-env .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png :target: https://translation.odoo-community.org/projects/server-env-18-0/server-env-18-0-server_environment :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png :target: https://runboat.odoo-community.org/builds?repo=OCA/server-env&target_branch=18.0 :alt: Try me on Runboat
|badge1| |badge2| |badge3| |badge4| |badge5|
This module provides a way to define an environment in the main Odoo
configuration file and to read some configurations from files depending
on the configured environment: you define the environment in the main
configuration file, and the values for the various possible environments
are stored in the server_environment_files
companion module.
The server_environment_files
module is optional, the values can be
set using an environment variable with a fallback on default values in
the database.
The configuration read from the files are visible under the Configuration menu. If you are not in the 'dev' environment you will not be able to see the values contained in the defined secret keys (by default : 'passw', 'key', 'secret' and 'token').
Table of contents
.. contents:: :local:
By itself, this module does little. See for instance the
mail_environment
addon which depends on this one to allow
configuring the incoming and outgoing mail servers depending on the
environment.
You can store your configuration values in a companion module called
server_environment_files
. You can copy and customize the provided
server_environment_files_sample
module for this purpose.
Alternatively, you can provide them in environment variables
SERVER_ENV_CONFIG
and SERVER_ENV_CONFIG_SECRET
.
To configure this module, you need to edit the main configuration file
of your instance, and add a directive called running_env
. Commonly
used values are 'dev', 'test', 'production':
::
[options] running_env=dev
Or set the RUNNING_ENV
or ODOO_STAGE
environment variable. If
both all are set config file will take the precedence on environment and
RUNNING_ENV
over ODOO_STAGE
.
ODOO_STAGE
is used for odoo.sh platform where we can't set
RUNNING_ENV
, possible observed values are production
,
staging
and dev
Values associated to keys containing 'passw' are only displayed in the 'dev' environment.
If you don't provide any value, test is used as a safe default.
You have several possibilities to set configuration values:
You can edit the settings you need in the server_environment_files
addon. The server_environment_files_sample
can be used as an
example:
default/
directory using the .ini file syntax;You can define configuration in the environment variable
SERVER_ENV_CONFIG
and/or SERVER_ENV_CONFIG_SECRET
. The 2
variables are handled the exact same way, this is only a convenience for
the deployment where you can isolate the secrets in a different,
encrypted, file. They are multi-line environment variables in the same
configparser format than the files. If you used options in
server_environment_files
, the options set in the environment
variable override them.
The options in the environment variable are not dependent of
running_env
, the content of the variable must be set accordingly to
the running environment.
Example of setup:
A public file, containing that will contain public variables:
::
export WORKERS='8' export MAX_CRON_THREADS='1' export LOG_LEVEL=info export LOG_HANDLER=":INFO" export DB_MAXCONN=5
export SERVER_ENV_CONFIG=" [storage_backend.my_sftp] sftp_server=10.10.10.10 sftp_login=foo sftp_port=22200 directory_path=Odoo "
A second file which is encrypted and contains secrets:
::
export DB_PASSWORD='xxxxxxxxx'
export SERVER_ENV_CONFIG_SECRET=" [storage_backend.my_sftp] sftp_password=xxxxxxxxx "
WARNING
my_sftp must match the name of the record. If you want something more reliable use server.env.techname.mixin and use tech_name field to reference records. See "USAGE".
When using the server.env.mixin
mixin, for each env-computed field,
a companion field <field>_env_default
is created. This field is not
environment-dependent. It's a fallback value used when no key is set in
configuration files / environment variable.
When the default field is used, the field is made editable on Odoo.
Note: empty environment keys always take precedence over default fields
Read the documentation of the class
models/server_env_mixin.py <models/server_env_mixin.py>
__.
You can include a mixin in your model and configure the env-computed
fields by an override of _server_env_fields
.
::
class StorageBackend(models.Model): _name = "storage.backend" _inherit = ["storage.backend", "server.env.mixin"]
@property
def _server_env_fields(self):
return {"directory_path": {}}
Read the documentation of the class and methods in
models/server_env_mixin.py <models/server_env_mixin.py>
__.
If you want to have a technical name to reference:
::
class StorageBackend(models.Model): _name = "storage.backend" _inherit = ["storage.backend", "server.env.techname.mixin", "server.env.mixin"]
[...]
Bugs are tracked on GitHub Issues <https://github.com/OCA/server-env/issues>
.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
feedback <https://github.com/OCA/server-env/issues/new?body=module:%20server_environment%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>
.
Do not contact contributors directly about support or help with technical issues.
This module is maintained by the OCA.
.. image:: https://odoo-community.org/logo.png :alt: Odoo Community Association :target: https://odoo-community.org
OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.
This module is part of the OCA/server-env <https://github.com/OCA/server-env/tree/18.0/server_environment>
_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
FAQs
move some configurations out of the database
We found that odoo-addon-server-environment demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.