Update PAYLOAD_SERVER_URL to PAYLOAD_URL and remove unused env var
This commit is contained in:
parent
fe5a99f370
commit
2c3b26a809
6
.env
6
.env
@ -1,10 +1,10 @@
|
||||
NAME=astroad
|
||||
ASTRO_HOST=localhost:3000
|
||||
PAYLOAD_HOST=payload:3001
|
||||
PAYLOAD_SERVER_URL=http://localhost:3001
|
||||
PAYLOAD_URL=http://localhost:3001
|
||||
PAYLOAD_PORT=3001
|
||||
PAYLOAD_SECRET=supersecretkey
|
||||
MONGODB_URI=mongodb://payload:test@mongo:27017
|
||||
MONGODB_USER=payload
|
||||
MONGODB_PW=test
|
||||
TOKEN=supersecrettoken
|
||||
NAME=astroad
|
||||
TOKEN=supersecrettoken
|
23
.github/workflows/push.yml
vendored
23
.github/workflows/push.yml
vendored
@ -37,25 +37,24 @@ jobs:
|
||||
replace_env() {
|
||||
local env_var=$1
|
||||
local new_value=$2
|
||||
local file=$3
|
||||
sed -i "s/${env_var}=.*/${env_var}=${new_value}/" $file
|
||||
sed -i "s/${env_var}=.*/${env_var}=${new_value}/" .env
|
||||
}
|
||||
|
||||
cd ${{ secrets.PATH }}
|
||||
|
||||
# Replace .env with vars
|
||||
replace_env 'NAME' '${{ vars.NAME }}' .env
|
||||
replace_env 'ASTRO_HOST' '${{ vars.ASTRO_HOST }}' .env
|
||||
replace_env 'PAYLOAD_HOST' '${{ vars.PAYLOAD_HOST }}' .env
|
||||
replace_env 'PAYLOAD_SERVER_URL' '${{ vars.PAYLOAD_SERVER_URL }}' .env
|
||||
replace_env 'PAYLOAD_PORT' '${{ vars.PAYLOAD_PORT }}' .env
|
||||
replace_env 'NAME' '${{ vars.NAME }}'
|
||||
replace_env 'ASTRO_HOST' '${{ vars.ASTRO_HOST }}'
|
||||
replace_env 'PAYLOAD_HOST' '${{ vars.PAYLOAD_HOST }}'
|
||||
replace_env 'PAYLOAD_URL' '${{ vars.PAYLOAD_URL }}'
|
||||
replace_env 'PAYLOAD_PORT' '${{ vars.PAYLOAD_PORT }}'
|
||||
|
||||
# Replace .env with secrets
|
||||
replace_env 'PAYLOAD_SECRET' '${{ secrets.PAYLOAD_SECRET }}' .env
|
||||
replace_env 'MONGODB_URI' '${{ secrets.MONGODB_URI }}' .env
|
||||
replace_env 'MONGODB_USER' '${{ secrets.MONGODB_USER }}' .env
|
||||
replace_env 'MONGODB_PW' '${{ secrets.MONGODB_PW }}' .env
|
||||
replace_env 'TOKEN' '${{ secrets.TOKEN }}' .env
|
||||
replace_env 'PAYLOAD_SECRET' '${{ secrets.PAYLOAD_SECRET }}'
|
||||
replace_env 'MONGODB_URI' '${{ secrets.MONGODB_URI }}'
|
||||
replace_env 'MONGODB_USER' '${{ secrets.MONGODB_USER }}'
|
||||
replace_env 'MONGODB_PW' '${{ secrets.MONGODB_PW }}'
|
||||
replace_env 'TOKEN' '${{ secrets.TOKEN }}'
|
||||
|
||||
mkdir -p ./astro
|
||||
cp .env ./astro/.env
|
||||
|
@ -29,7 +29,7 @@ Variables:
|
||||
|
||||
- ASTRO_HOST: Hostdomain of the Frontend
|
||||
- PAYLOAD_HOST: Hostdomain of the CMS
|
||||
- PAYLOAD_SERVER_URL: URL of the CMS
|
||||
- PAYLOAD_URL: URL of the CMS
|
||||
- NAME: Name of the Container and Project
|
||||
|
||||
Please remember to set these secrets and variables in your repository settings to ensure a successful deployment through Github Workflows.
|
||||
|
@ -2,7 +2,7 @@ import type { Post } from "../types";
|
||||
|
||||
const url = import.meta.env.DEV
|
||||
? "http://payload:3001"
|
||||
: `${import.meta.env.PAYLOAD_SERVER_URL}`;
|
||||
: `${import.meta.env.PAYLOAD_URL}`;
|
||||
|
||||
export const getPosts = async () =>
|
||||
(await (await fetch(`${url}/api/posts`)).json()).docs as Post[];
|
||||
|
@ -15,7 +15,7 @@ services:
|
||||
build:
|
||||
context: payload
|
||||
environment:
|
||||
PAYLOAD_SERVER_URL: ${PAYLOAD_SERVER_URL}
|
||||
PAYLOAD_URL: ${PAYLOAD_URL}
|
||||
PAYLOAD_PORT: ${PAYLOAD_PORT}
|
||||
PAYLOAD_SECRET: ${PAYLOAD_SECRET}
|
||||
MONGODB_URI: ${MONGODB_URI}
|
||||
|
@ -5,7 +5,7 @@ import Users from "./collections/Users";
|
||||
import Media from "./collections/Media";
|
||||
|
||||
export default buildConfig({
|
||||
serverURL: process.env.PAYLOAD_SERVER_URL,
|
||||
serverURL: process.env.PAYLOAD_URL,
|
||||
admin: {
|
||||
user: Users.slug,
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user