From 7fec9700c46cf1ba76bf5ccc0076f15b221240c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Ara=C3=BAjo=20Paes?= <38794747+ricardoapaes@users.noreply.github.com> Date: Tue, 15 Oct 2024 20:50:33 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Adding=20minimum=20and=20maximum?= =?UTF-8?q?=20port=20as=20environment=20variable=20(#136)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 🔧 Adding minimum and maximum port as environment variable * 🏗️ Updating `actions/*` to v4 because nodejs version is old --- .github/workflows/ci.yml | 6 +++--- .github/workflows/docker.yml | 2 +- .github/workflows/mean_bean_ci.yml | 12 ++++++------ .github/workflows/mean_bean_deploy.yml | 12 ++++++------ README.md | 4 ++-- src/main.rs | 4 ++-- 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 623d733..8550948 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ jobs: name: Build and Test runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: actions-rs/toolchain@v1 with: @@ -26,7 +26,7 @@ jobs: name: Rustfmt runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: actions-rs/toolchain@v1 with: @@ -40,7 +40,7 @@ jobs: name: Clippy runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: actions-rs/toolchain@v1 with: diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index d4eec2b..e70a2ab 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Docker meta id: meta diff --git a/.github/workflows/mean_bean_ci.yml b/.github/workflows/mean_bean_ci.yml index 5f7c977..7a7b8d7 100644 --- a/.github/workflows/mean_bean_ci.yml +++ b/.github/workflows/mean_bean_ci.yml @@ -10,7 +10,7 @@ jobs: install-cross: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 with: fetch-depth: 50 @@ -22,7 +22,7 @@ jobs: matches: ${{ matrix.platform }} token: ${{ secrets.GITHUB_TOKEN }} - - uses: actions/upload-artifact@v1 + - uses: actions/upload-artifact@v4 with: name: cross-${{ matrix.platform }} path: ${{ steps.cross.outputs.install_path }} @@ -41,7 +41,7 @@ jobs: steps: - name: Setup | Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Setup | Rust uses: actions-rs/toolchain@v1 with: @@ -61,12 +61,12 @@ jobs: runs-on: ubuntu-latest needs: install-cross steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: fetch-depth: 50 - name: Download Cross - uses: actions/download-artifact@v1 + uses: actions/download-artifact@v4 with: name: cross-linux-musl path: /tmp/ @@ -105,7 +105,7 @@ jobs: # artifacts are downloaded first. needs: install-cross steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: fetch-depth: 50 - run: ci/set_rust_version.bash ${{ matrix.channel }} ${{ matrix.target }} diff --git a/.github/workflows/mean_bean_deploy.yml b/.github/workflows/mean_bean_deploy.yml index 0982286..a37bcdf 100644 --- a/.github/workflows/mean_bean_deploy.yml +++ b/.github/workflows/mean_bean_deploy.yml @@ -16,7 +16,7 @@ jobs: install-cross: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 with: fetch-depth: 50 @@ -28,7 +28,7 @@ jobs: matches: ${{ matrix.platform }} token: ${{ secrets.GITHUB_TOKEN }} - - uses: actions/upload-artifact@v1 + - uses: actions/upload-artifact@v4 with: name: cross-${{ matrix.platform }} path: ${{ steps.cross.outputs.install_path }} @@ -50,7 +50,7 @@ jobs: uses: dawidd6/action-get-tag@v1 - name: Setup | Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 # Cache files between builds - name: Setup | Cache Cargo @@ -114,8 +114,8 @@ jobs: id: tag uses: dawidd6/action-get-tag@v1 - - uses: actions/checkout@v2 - - uses: actions/download-artifact@v1 + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 with: name: cross-linux-musl path: /tmp/ @@ -163,7 +163,7 @@ jobs: id: tag uses: dawidd6/action-get-tag@v1 - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - run: bash ci/set_rust_version.bash stable ${{ matrix.target }} - run: bash ci/build.bash cargo ${{ matrix.target }} RELEASE - run: | diff --git a/README.md b/README.md index ba609dc..022aae4 100644 --- a/README.md +++ b/README.md @@ -93,8 +93,8 @@ Runs the remote proxy server Usage: bore server [OPTIONS] Options: - --min-port Minimum accepted TCP port number [default: 1024] - --max-port Maximum accepted TCP port number [default: 65535] + --min-port Minimum accepted TCP port number [default: 1024, env: BORE_MIN_PORT] + --max-port Maximum accepted TCP port number [default: 65535, env: BORE_MAX_PORT] -s, --secret Optional secret for authentication [env: BORE_SECRET] -h, --help Print help information ``` diff --git a/src/main.rs b/src/main.rs index 0735ae1..e08125c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -36,11 +36,11 @@ enum Command { /// Runs the remote proxy server. Server { /// Minimum accepted TCP port number. - #[clap(long, default_value_t = 1024)] + #[clap(long, default_value_t = 1024, env = "BORE_MIN_PORT")] min_port: u16, /// Maximum accepted TCP port number. - #[clap(long, default_value_t = 65535)] + #[clap(long, default_value_t = 65535, env = "BORE_MAX_PORT")] max_port: u16, /// Optional secret for authentication.