Skip to content

Commit

Permalink
heya
Browse files Browse the repository at this point in the history
Signed-off-by: Max Schmidt <max.schmidt@outlook.de>
  • Loading branch information
mooxl committed May 17, 2023
1 parent d30d3e6 commit 2889ccc
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 5 deletions.
3 changes: 1 addition & 2 deletions .env.dev
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion .env.prod
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Empty file removed .github/workflows/push
Empty file.
17 changes: 17 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -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
9 changes: 7 additions & 2 deletions astro/src/utils/payload.ts
Original file line number Diff line number Diff line change
@@ -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;
2 changes: 2 additions & 0 deletions docker-compose-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ services:
build:
context: astro
target: prod
environment:
PAYLOAD_URL: ${PAYLOAD_URL}
ports:
- 3000:3000

Expand Down

0 comments on commit 2889ccc

Please sign in to comment.