diff --git a/docs/ENVIRONMENT.rst b/docs/ENVIRONMENT.rst index 5c63cd5..9a52245 100644 --- a/docs/ENVIRONMENT.rst +++ b/docs/ENVIRONMENT.rst @@ -116,8 +116,10 @@ These environment variables are optional: You can place several meta-variables in your banner file, which will be replaced before serving to a client. - + **$VERSION** is replaced with the ElectrumX version you are - runnning, such as *ElectrumX 0.9.22*. + + **$SERVER_VERSION** is replaced with the ElectrumX version you are + runnning, such as *1.0.10*. + + **$SERVER_SUBVERSION** is replaced with the ElectrumX user agent + string. For example, `ElectrumX 1.0.10`. + **$DAEMON_VERSION** is replaced with the daemon's version as a dot-separated string. For example *0.12.1*. + **$DAEMON_SUBVERSION** is replaced with the daemon's user agent diff --git a/server/session.py b/server/session.py index b184e41..a59c9a8 100644 --- a/server/session.py +++ b/server/session.py @@ -288,8 +288,11 @@ class ElectrumX(SessionBase): minor, revision = divmod(minor, 10000) revision //= 100 daemon_version = '{:d}.{:d}.{:d}'.format(major, minor, revision) + server_version = version.VERSION.split()[-1] for pair in [ - ('$VERSION', version.VERSION), + ('$VERSION', version.VERSION), # legacy + ('$SERVER_VERSION', server_version), + ('$SERVER_SUBVERSION', version.VERSION), ('$DAEMON_VERSION', daemon_version), ('$DAEMON_SUBVERSION', network_info['subversion']), ('$DONATION_ADDRESS', self.env.donation_address),