Skip to content

Commit

Permalink
fix(network_manager_networks): properly override port
Browse files Browse the repository at this point in the history
  • Loading branch information
alxwr committed Aug 5, 2019
1 parent 7ee9eed commit 1d58ec6
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions openvpn/network_manager_networks/files/connection.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,24 @@ auth={{ vpn_data.pop('auths')|first }}
{%- endif %}

{%- set remote = vpn_data.pop('remote', False) %}
{%- set port = vpn_data.pop('port', 1194) %}
{%- set port = vpn_data.pop('port', False) %}
{%- if remote is iterable and not remote is string %}
{%- set remote = remote|first %}
{%- endif %}
{%- if remote is string %}
{%- set remote_pair = remote.split(' ') %}
{%- set remote = remote_pair|first %}
{%- if remote_pair|length > 1 %}
{%- if not port and remote_pair|length > 1 %}
{%- set port = remote_pair|last %}
{%- endif %}
{%- endif %}
{%- if remote and port %}
{%- if remote %}
remote={{ remote }}
port={{ port }}
{%- endif %}
{%- if not port %}
{%- set port = 1194 %}
{%- endif %}
port={{ port }}

{%- if 'tls_auth' in vpn_data %}
ta-dir={{ multipart_param(vpn_data.tls_auth, 1) }}
Expand Down

0 comments on commit 1d58ec6

Please sign in to comment.