[IMP] odoo.sh: ip changes
closes odoo/documentation#10801
X-original-commit: ca18df8f27
Signed-off-by: Stanislas Sobieski (sts) <sts@odoo.com>
This commit is contained in:
parent
ccba69014c
commit
ebc6608f65
@ -29,3 +29,32 @@ We advise that:
|
||||
- Your scheduled actions should be
|
||||
`idempotent <https://stackoverflow.com/a/1077421/3332416>`_: they must not
|
||||
cause side-effects if they are started more often than expected.
|
||||
|
||||
.. _ip-address-change:
|
||||
|
||||
How can I automate tasks when an IP address change occurs?
|
||||
----------------------------------------------------------
|
||||
|
||||
**Odoo.sh notifies project administrators of IP address changes.**
|
||||
Additionally, when the IP address of a production instance changes, an HTTP `GET` request is made
|
||||
to the path `/_odoo.sh/ip-change` with the new IP address included as a query string parameter
|
||||
(`new`), along with the previous IP address as an additional parameter (`old`).
|
||||
|
||||
This mechanism allows custom actions to be applied in response to the IP address change
|
||||
(e.g., sending an email, contacting a firewall API, configuring database objects, etc.)
|
||||
|
||||
For security reasons, the `/_odoo.sh/ip-change` route is accessible only internally by the platform
|
||||
itself and returns a `403` response if accessed through any other means.
|
||||
|
||||
Here is a pseudo-implementation example:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
class IPChangeController(http.Controller):
|
||||
|
||||
@http.route('/_odoo.sh/ip-change', auth='public')
|
||||
def ip_change(self, old=None, new=None):
|
||||
_logger.info("IP address changed from %s to %s", old, new)
|
||||
# Then perform whatever action required for your use case, e.g., update an
|
||||
# ir.config_parameter, send an email, contact an external firewall service's API, ...
|
||||
return 'ok'
|
||||
|
Loading…
Reference in New Issue
Block a user