Skip to content

Commit

Permalink
feat (event) : register to user-domain-changed
Browse files Browse the repository at this point in the history
  • Loading branch information
stephdl committed Nov 22, 2024
1 parent 630efa7 commit fe62d51
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions imageroot/events/user-domain-changed/10configure_module
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env python3

#
# Copyright (C) 2022 Nethesis S.r.l.
# SPDX-License-Identifier: GPL-3.0-or-later
#

import sys
import json
import os
import webtop
import agent


event_input = json.load(sys.stdin)

rdb = agent.redis_connect(use_replica=True)

providers = agent.list_service_providers(rdb, 'imap', 'tcp', {
'module_uuid': os.environ.get('MAIL_MODULE_UUID', '')
})

user_domain = providers[0]['user_domain']

if event_input.get('domain') == user_domain:
webtop.configure_module(providers[0]['module_id'], os.environ)

0 comments on commit fe62d51

Please sign in to comment.