-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gh actions ci cd & change method from query to wildcard path
- Loading branch information
Showing
14 changed files
with
137 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: Registry express proxy to Docker Hub | ||
on: [workflow_dispatch] | ||
jobs: | ||
dockerize: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v4 | ||
- name: build image | ||
run: docker build ./express-proxy -t piotrekdockerxd/express-proxy:latest | ||
- name: push image to docker hub | ||
run: | | ||
docker login -u piotrekdockerxd -p ${{ secrets.DOCKER_HUB_TOKEN }} | ||
docker push piotrekdockerxd/express-proxy:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: Registry fastify proxy to Docker Hub | ||
on: [workflow_dispatch] | ||
jobs: | ||
dockerize: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v4 | ||
- name: build image | ||
run: docker build ./fastify-proxy -t piotrekdockerxd/fastify-proxy:latest | ||
- name: push image to docker hub | ||
run: | | ||
docker login -u piotrekdockerxd -p ${{ secrets.DOCKER_HUB_TOKEN }} | ||
docker push piotrekdockerxd/fastify-proxy:latest |
11 changes: 4 additions & 7 deletions
11
.github/workflows/main.yaml → .github/workflows/render.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
FROM node:latest | ||
|
||
WORKDIR /app | ||
|
||
COPY package.json yarn.lock ./ | ||
|
||
RUN yarn --pure-lockfile | ||
|
||
COPY . . | ||
|
||
RUN yarn build | ||
|
||
ARG PORT=3000 | ||
|
||
ENV PORT=$PORT | ||
|
||
EXPOSE $PORT | ||
|
||
CMD ["yarn", "start"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import axios, { AxiosInstance, InternalAxiosRequestConfig } from "axios"; | ||
|
||
const createAxiosWithAbortSupport = (timeout: number): AxiosInstance => { | ||
const axiosInstance = axios.create({ | ||
timeout: timeout, | ||
}); | ||
|
||
axiosInstance.interceptors.request.use((config) => { | ||
const controller = new AbortController(); | ||
config.signal = controller.signal; | ||
config.cancelToken = new axios.CancelToken((cancel) => { | ||
(config as any).cancelRequest = () => { | ||
controller.abort(); | ||
cancel("Request canceled"); | ||
}; | ||
}); | ||
|
||
return config; | ||
}); | ||
|
||
return axiosInstance; | ||
}; | ||
|
||
const axiosInstance = createAxiosWithAbortSupport(10000); | ||
|
||
export default axiosInstance; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,17 @@ | ||
import { FastifyReply, FastifyRequest } from "fastify"; | ||
import { TUrlQuery } from "./url.schema"; | ||
import { TUrlParam } from "./url.schema"; | ||
|
||
const preHandler = async ( | ||
request: FastifyRequest<{ | ||
Querystring: TUrlQuery; | ||
}>, | ||
request: FastifyRequest<{ Params: TUrlParam }>, | ||
reply: FastifyReply | ||
) => { | ||
const rawQuery = request.raw.url?.split("?link=")[1]; | ||
const rawQuery = request.originalUrl.replace("/url/", ""); | ||
if (!rawQuery) { | ||
reply.status(400).send({ error: 'Missing "link" parameter' }); | ||
return; | ||
} | ||
const encodeURL = decodeURIComponent(rawQuery); | ||
request.query = { link: encodeURL }; | ||
request.params["*"] = rawQuery; | ||
console.log(`RAWQUERY`, rawQuery); | ||
}; | ||
|
||
export { preHandler }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.