Skip to content

Commit

Permalink
Merge pull request #805 from MetPX/issue802-post-broker-user
Browse files Browse the repository at this point in the history
for #802 adds POST_BROKER_USER
  • Loading branch information
andreleblanc11 authored Nov 3, 2023
2 parents 640e285 + db90eed commit c33898b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/source/Reference/sr3_options.7.rst
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ option, with the use of *${..}* notation:
* PBD - the post base dir
* *var* - any environment variable.
* BROKER_USER - the user name for authenticating to the broker (e.g. anonymous)
* POST_BROKER_USER - the user name for authenticating to the post_broker (e.g. anonymous)
* PROGRAM - the name of the component (subscribe, shovel, etc...)
* CONFIG - the name of the configuration file being run.
* HOSTNAME - the hostname running the client.
Expand Down
1 change: 1 addition & 0 deletions docs/source/fr/Reference/sr3_options.7.rst
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ en utilisant la notation *${..} * :
* PBD - le "post base dir".
* *var* - n'importe quelle variable d’environnement.
* BROKER_USER - le nom d’utilisateur pour l’authentification auprès du courtier (par exemple, anonyme)
* POST_BROKER_USER - le nom d’utilisateur pour l’authentification auprès du courtier de destination (post_broker)
* PROGRAM - le nom du composant (subscribe, shovel, etc...)
* CONFIG - le nom du fichier de configuration en cours d'exécution.
* HOSTNAME - le hostname qui exécute le client.
Expand Down
4 changes: 4 additions & 0 deletions sarracenia/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -909,6 +909,10 @@ def _varsub(self, word):
result = result.replace('${BROKER_USER}', self.broker.url.username)
# FIXME: would this work also automagically if BROKER.USERNAME ?

if (('${POST_BROKER_USER}' in word) and hasattr(self, 'post_broker') and self.post_broker is not None and
self.post_broker.url is not None and hasattr(self.post_broker.url, 'username')):
result = result.replace('${POST_BROKER_USER}', self.post_broker.url.username)

if not '$' in result:
return result

Expand Down

0 comments on commit c33898b

Please sign in to comment.