Skip to content

Commit

Permalink
IPv6 URL fix (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored Mar 5, 2024
1 parent 63acdb2 commit b146bef
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 25 deletions.
28 changes: 23 additions & 5 deletions .github/workflows/prep-internal-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
on:
workflow_dispatch:
inputs:
prev_branch_name:
description: 'Prev branch name, must start with v'
required: true
default: 'v0.1.0-rc.1'
release_branch_name:
description: 'Release branch name, must start with v'
required: true
default: 'v0.1.0-rc.1'
default: 'v0.1.0-rc.2'


jobs:
Expand Down Expand Up @@ -86,12 +90,26 @@ jobs:
echo Review and approve PR before release can continue
exit 1 // force actions stop here
- name: Create the release branch
uses: peterjgrainger/[email protected]
- name: Create release branch starting point
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
branch: "${{ github.event.inputs.release_branch_name }}"
run: |
git fetch
git push origin refs/remotes/origin/${{ github.event.inputs.prev_branch_name }}:refs/heads/${{ github.event.inputs.release_branch_name }}
- name: Create PR to release branch
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
CURRENT_BRANCH=${GITHUB_REF_NAME}
gh pr create -B ${{ github.event.inputs.release_branch_name }} --title "New release ${{ github.event.inputs.release_branch_name }}" --body 'Created by Github action'
# - name: Create PR to release branch
# uses: peterjgrainger/[email protected]
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# branch: "${{ github.event.inputs.release_branch_name }}"

# - name: Tag the release branch
# if: env.NEXT_DEV_VERSION != ''
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Important: The REST delivery point must have permission to consume messages from

### Optional

* `client_profile_name` - the [client profile associated](https://docs.solace.com/Services/Managing-RDPs.htm#associating-client-profiles-with-REST-delivery-points). If not provided, the `default` client profile for the Message VPN will be associated.
* `request_headers` - A set of request headers to be added to the HTTP request
* `protected_request_headers` - A set of protected request headers with sensitive value to be added to the HTTP request
* `rest_consumer_name` - The name of the REST consumer to be created. The default is `consumer`.
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.0-rc.2
0.1.0-rc.3
35 changes: 19 additions & 16 deletions examples/basic/main.tf
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# Copyright 2024 Solace Corporation. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Copyright 2024 Solace Corporation. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

provider "solacebroker" {
username = "admin"
password = "admin"
Expand Down Expand Up @@ -50,8 +50,11 @@ module "testrdp" {
msg_vpn_name = "default"
rest_delivery_point_name = "basic_rdp"
url = "https://example.com/test"
# queue_name = module.rdp_queue.queue.queue_name
queue_name = solacebroker_msg_vpn_queue.rdp_queue.queue_name
# queue_name = module.rdp_queue.queue.queue_name
queue_name = solacebroker_msg_vpn_queue.rdp_queue.queue_name

# Example configuration of a client profile. Commented out here since the "default" client profile will be used if not specified
# client_profile_name = "default"
}

output "rdp" {
Expand Down
2 changes: 1 addition & 1 deletion internal/gen-template/main.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
locals {
tls = startswith(lower(var.url), "https:")
slashSplit = split("/", var.url)
isIpV6HostWithPort = length(split("]", local.slashSplit[2])) == 2
isIpV6HostWithPort = length(split("]", local.slashSplit[2])) == 2
isIpV6NoPort = local.isIpV6HostWithPort ? false : length(split(":", local.slashSplit[2])) > 2
address = local.isIpV6NoPort ? join(local.slashSplit[2], ["[", "]"]) : local.slashSplit[2]
hostPortSplit = local.isIpV6HostWithPort || local.isIpV6NoPort ? split("]:", trimprefix(local.address, "[")) : split(":", local.address)
Expand Down
6 changes: 4 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
locals {
tls = startswith(lower(var.url), "https:")
slashSplit = split("/", var.url)
isIpV6HostPort = length(split("]", local.slashSplit[2])) == 2
hostPortSplit = local.isIpV6HostPort ? split("]:", trimprefix(local.slashSplit[2], "[")) : split(":", local.slashSplit[2])
isIpV6HostWithPort = length(split("]", local.slashSplit[2])) == 2
isIpV6NoPort = local.isIpV6HostWithPort ? false : length(split(":", local.slashSplit[2])) > 2
address = local.isIpV6NoPort ? join(local.slashSplit[2], ["[", "]"]) : local.slashSplit[2]
hostPortSplit = local.isIpV6HostWithPort || local.isIpV6NoPort ? split("]:", trimprefix(local.address, "[")) : split(":", local.address)
host = trimsuffix(local.hostPortSplit[0], "]")
port = length(local.hostPortSplit) == 2 ? tonumber(local.hostPortSplit[1]) : (local.tls ? 443 : 80)
path = "/${join("/", slice(local.slashSplit, 3, length(local.slashSplit)))}"
Expand Down

0 comments on commit b146bef

Please sign in to comment.