forked from Hithomelabs/CFTunnels
Compare commits
No commits in common. "test" and "main" have entirely different histories.
@ -1,4 +0,0 @@
|
|||||||
CLOUDFLARE_ACCOUNT_ID="<cloudflare account id>"
|
|
||||||
CLOUDFLARE_API_KEY="<cloudflare account key>"
|
|
||||||
CLOUDFLARE_EMAIL="<cloudflare email>"
|
|
||||||
ENV="<deployment env>"
|
|
||||||
@ -1,20 +0,0 @@
|
|||||||
name: sample gradle build and test
|
|
||||||
run-name: Build started by $ {{gitea.actor}}
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
branches: [test]
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Check out repository code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
- name: JDK setup
|
|
||||||
uses: actions/setup-java@v4
|
|
||||||
with:
|
|
||||||
distribution: 'zulu'
|
|
||||||
java-version: '17'
|
|
||||||
- name: Validate Gradle Wrapper
|
|
||||||
uses: gradle/actions/wrapper-validation@v3
|
|
||||||
- name: Gradle build
|
|
||||||
run: ./gradlew build --info
|
|
||||||
@ -1,64 +0,0 @@
|
|||||||
name: sample gradle build and test
|
|
||||||
run-name: Build started by $ {{gitea.actor}}
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [test]
|
|
||||||
jobs:
|
|
||||||
tag:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
outputs:
|
|
||||||
new_version: ${{ steps.new_version.outputs.new_version }}
|
|
||||||
steps:
|
|
||||||
- name: Check out repository code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
- name: Get new version
|
|
||||||
id: new_version
|
|
||||||
run: |
|
|
||||||
VERSION=$(git describe --tags --abbrev=0)
|
|
||||||
echo ${VERSION}
|
|
||||||
MAJOR=$(echo ${VERSION} | cut -d "." -f 1)
|
|
||||||
MINOR=$(echo ${VERSION} | cut -d "." -f 2)
|
|
||||||
PATCH=$(echo ${VERSION} | cut -d "." -f 3)
|
|
||||||
NEW_PATCH=$(( ${PATCH} + 1))
|
|
||||||
echo ${NEW_PATCH}
|
|
||||||
echo "new_version=$(echo "${MAJOR}.${MINOR}.${NEW_PATCH}")" >> $GITHUB_OUTPUT
|
|
||||||
build_tag_push:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: tag
|
|
||||||
container:
|
|
||||||
image: catthehacker/ubuntu:act-latest
|
|
||||||
steps:
|
|
||||||
- name: Check out repository code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
- name: JDK setup
|
|
||||||
uses: actions/setup-java@v4
|
|
||||||
with:
|
|
||||||
distribution: 'zulu'
|
|
||||||
java-version: '17'
|
|
||||||
- name: Validate Gradle Wrapper
|
|
||||||
uses: gradle/actions/wrapper-validation@v3
|
|
||||||
- name: Create and push tag
|
|
||||||
run: |
|
|
||||||
echo "NEW_VERSION=${{ needs.tag.outputs.new_version }}"
|
|
||||||
git config --global user.name "${{gitea.actor}}"
|
|
||||||
git config --global user.email "${{ gitea.actor }}@users.noreply.github.com"
|
|
||||||
git tag -a ${{ needs.tag.outputs.new_version }} -m "Pushing new version ${{ needs.tag.outputs.new_version }}"
|
|
||||||
git push origin ${{ needs.tag.outputs.new_version }}
|
|
||||||
- name: Log in to Gitea Docker Registry
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: 'http://192.168.0.100:8928'
|
|
||||||
username: hitanshu
|
|
||||||
password: ${{ secrets.TOKEN }}
|
|
||||||
- name: Gradle build
|
|
||||||
run: ./gradlew bootBuildImage --imageName=192.168.0.100:8928/hithomelabs/cftunnels:${{ needs.tag.outputs.new_version }}
|
|
||||||
- name: Tag image as test
|
|
||||||
run: docker tag 192.168.0.100:8928/hithomelabs/cftunnels:${{ needs.tag.outputs.new_version }} 192.168.0.100:8928/hithomelabs/cftunnels:test
|
|
||||||
- name: Push to Gitea Registry
|
|
||||||
run: |
|
|
||||||
docker push 192.168.0.100:8928/hithomelabs/cftunnels:test
|
|
||||||
docker push 192.168.0.100:8928/hithomelabs/cftunnels:${{ needs.tag.outputs.new_version }}
|
|
||||||
@ -5,7 +5,7 @@ meta {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get {
|
get {
|
||||||
url: {{base_url}}/cloudflare/tunnels
|
url: http://localhost8080/cloudflare/tunnels
|
||||||
body: none
|
body: none
|
||||||
auth: none
|
auth: none
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,7 @@ meta {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get {
|
get {
|
||||||
url: {{base_url}}/cloudflare/tunnel/{{tunnel_id}}
|
url: http://localhost:8080/cloudflare/tunnel/{{tunnel_id}}
|
||||||
body: none
|
body: none
|
||||||
auth: none
|
auth: none
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,16 +4,8 @@ meta {
|
|||||||
seq: 2
|
seq: 2
|
||||||
}
|
}
|
||||||
|
|
||||||
put {
|
post {
|
||||||
url: {{base_url}}/cloudflare/tunnel/{{tunnel_id}}/add
|
url: http://localhost:8080/cloudflare/tunnel/50df9101-f625-4618-b7c5-100338a57124
|
||||||
body: json
|
body: none
|
||||||
auth: none
|
auth: none
|
||||||
}
|
}
|
||||||
|
|
||||||
body:json {
|
|
||||||
{
|
|
||||||
"service": "http://192.168.0.100:3457",
|
|
||||||
"hostname": "random.hithomelabs.com",
|
|
||||||
"originRequest": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@ -5,15 +5,7 @@ meta {
|
|||||||
}
|
}
|
||||||
|
|
||||||
put {
|
put {
|
||||||
url: {{base_url}}/cloudflare/tunnel/{{tunnel_id}}/delete
|
url: http://localhost:8080/cloudflare/tunnel/50df9101-f625-4618-b7c5-100338a57124/add
|
||||||
body: json
|
body: none
|
||||||
auth: none
|
auth: none
|
||||||
}
|
}
|
||||||
|
|
||||||
body:json {
|
|
||||||
{
|
|
||||||
"service": "http://192.168.0.100:6000",
|
|
||||||
"hostname": "random.hithomelabs.com",
|
|
||||||
"originRequest": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@ -1,4 +0,0 @@
|
|||||||
vars {
|
|
||||||
tunnel_id: 50df9101-f625-4618-b7c5-100338a57124
|
|
||||||
base_url: http://localhost:8080
|
|
||||||
}
|
|
||||||
@ -1,4 +1,3 @@
|
|||||||
vars {
|
vars {
|
||||||
tunnel_id: 50df9101-f625-4618-b7c5-100338a57124
|
tunnel_id: 50df9101-f625-4618-b7c5-100338a57124
|
||||||
base_url: https://testcf.hithomelabs.com
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,16 +13,12 @@ java {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
test {
|
|
||||||
systemProperty 'spring.profiles.active', 'test'
|
|
||||||
}
|
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation group: 'org.springdoc', name: 'springdoc-openapi-starter-webmvc-ui', version: '2.8.5'
|
implementation group: 'org.springdoc', name: 'springdoc-openapi-starter-webmvc-ui', version: '2.0.3'
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-web'
|
implementation 'org.springframework.boot:spring-boot-starter-web'
|
||||||
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||||||
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
||||||
|
|||||||
@ -1,12 +0,0 @@
|
|||||||
services:
|
|
||||||
app:
|
|
||||||
image: gitea.hithomelabs.com/hithomelabs/cftunnels:${ENV}
|
|
||||||
container_name: cftunnels_${ENV}
|
|
||||||
environment:
|
|
||||||
- CLOUDFLARE_ACCOUNT_ID=${CLOUDFLARE_ACCOUNT_ID}
|
|
||||||
- CLOUDFLARE_API_KEY=${CLOUDFLARE_API_KEY}
|
|
||||||
- CLOUDFLARE_EMAIL=${CLOUDFLARE_EMAIL}
|
|
||||||
- ENV=${ENV}
|
|
||||||
ports:
|
|
||||||
- 5002:8080
|
|
||||||
restart: unless-stopped
|
|
||||||
@ -1,26 +0,0 @@
|
|||||||
package com.hithomelabs.CFTunnels.Config;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.models.OpenAPI;
|
|
||||||
import io.swagger.v3.oas.models.servers.Server;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
public class OpenApiConfig {
|
|
||||||
|
|
||||||
@Value("${api.baseUrl}")
|
|
||||||
private String baseUrl;
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public OpenAPI openAPI(){
|
|
||||||
Server httpsServer = new Server().url(baseUrl);
|
|
||||||
OpenAPI openApi = new OpenAPI();
|
|
||||||
ArrayList<Server> servers = new ArrayList<>();
|
|
||||||
servers.add(httpsServer);
|
|
||||||
openApi.setServers(servers);
|
|
||||||
return openApi;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -8,16 +8,6 @@ public class Ingress {
|
|||||||
private String service;
|
private String service;
|
||||||
private String hostname;
|
private String hostname;
|
||||||
private Map<String, Object> originRequest;
|
private Map<String, Object> originRequest;
|
||||||
private String path;
|
|
||||||
|
|
||||||
|
|
||||||
public String getPath() {
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPath(String path) {
|
|
||||||
this.path = path;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean deleteByHostName(List<Ingress> ingressList, String toBeDeleted){
|
public static boolean deleteByHostName(List<Ingress> ingressList, String toBeDeleted){
|
||||||
return ingressList.removeIf(ingress -> ingress.getHostname() != null && ingress.getHostname().equals(toBeDeleted));
|
return ingressList.removeIf(ingress -> ingress.getHostname() != null && ingress.getHostname().equals(toBeDeleted));
|
||||||
|
|||||||
@ -1 +0,0 @@
|
|||||||
api.baseUrl=http://localhost:8080
|
|
||||||
@ -1 +0,0 @@
|
|||||||
api.baseUrl=https://cftunnels.hithomelabs.com
|
|
||||||
@ -1 +0,0 @@
|
|||||||
api.baseUrl=https://testcf.hithomelabs.com
|
|
||||||
@ -2,4 +2,3 @@ spring.application.name=CFTunnels
|
|||||||
cloudflare.accountId=${CLOUDFLARE_ACCOUNT_ID}
|
cloudflare.accountId=${CLOUDFLARE_ACCOUNT_ID}
|
||||||
cloudflare.apiKey=${CLOUDFLARE_API_KEY}
|
cloudflare.apiKey=${CLOUDFLARE_API_KEY}
|
||||||
cloudflare.email=${CLOUDFLARE_EMAIL}
|
cloudflare.email=${CLOUDFLARE_EMAIL}
|
||||||
spring.profiles.active=${ENV}
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user