Signed-off-by: Max Schmidt <max.schmidt@outlook.de>
This commit is contained in:
Max Schmidt 2023-05-17 12:27:22 +02:00
parent d30d3e61b9
commit 2889ccc655
6 changed files with 28 additions and 5 deletions

View File

@ -1,7 +1,6 @@
ASTRO_TO_PAYLOAD_URL=http://payload:3001
PAYLOAD_SECRET=supersecretkey
PAYLOAD_URL=http://localhost:3001
PAYLOAD_PORT=3001
PAYLOAD_SECRET=supersecretkey
MONGODB_URI=mongodb://payload:test@mongo:27017
MONGODB_USER=payload
MONGODB_PW=test

View File

@ -1,6 +1,6 @@
PAYLOAD_SECRET=supersecretkey
PAYLOAD_URL=http://localhost:3001
PAYLOAD_PORT=3001
PAYLOAD_SECRET=supersecretkey
MONGODB_URI=mongodb://payload:test@mongo:27017
MONGODB_USER=payload
MONGODB_PW=test

View File

17
.github/workflows/push.yml vendored Normal file
View File

@ -0,0 +1,17 @@
name: Clone or pull repository
on:
branches:
- prod
jobs:
build:
name: Run remote SSH command
runs-on: ubuntu-latest
steps:
- name: Trigger build via ssh
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USER }}
key: ${{ secrets.KEY }}
script: |
ls

View File

@ -1,7 +1,12 @@
import type { Post } from "../types";
const url =
process.env.NODE_ENV === "development"
? "http://payload:3001"
: `https://${process.env.PAYLOAD_URL}`;
export const getPosts = async () =>
(await (await fetch("http://payload:3001/api/posts")).json()).docs as Post[];
(await (await fetch(`${url}/api/posts`)).json()).docs as Post[];
export const getPost = async (id: string) =>
(await (await fetch(`http://payload:3001/api/posts/${id}`)).json()) as Post;
(await (await fetch(`${url}/api/posts/${id}`)).json()) as Post;

View File

@ -3,6 +3,8 @@ services:
build:
context: astro
target: prod
environment:
PAYLOAD_URL: ${PAYLOAD_URL}
ports:
- 3000:3000