Rename NEXT_PUBLIC_... env variables to allow reading from env at runtime
This commit is contained in:
parent
834a38046f
commit
376220b26e
10 changed files with 22 additions and 22 deletions
|
@ -1,9 +1,9 @@
|
|||
FROM node:alpine
|
||||
|
||||
ARG NEXT_PUBLIC_WS_URL='ws://127.0.0.1:3001'
|
||||
ARG NEXT_PUBLIC_API_URL='http://127.0.0.1:3001/api'
|
||||
ENV NEXT_PUBLIC_WS_URL=${NEXT_PUBLIC_WS_URL}
|
||||
ENV NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}
|
||||
ARG BACKEND_WS_URL='ws://127.0.0.1:3001'
|
||||
ARG BACKEND_API_URL='http://127.0.0.1:3001/api'
|
||||
ENV BACKEND_WS_URL=${BACKEND_WS_URL}
|
||||
ENV BACKEND_API_URL=${BACKEND_API_URL}
|
||||
|
||||
WORKDIR /home/perplexica
|
||||
|
||||
|
|
|
@ -20,8 +20,8 @@ docker compose down --rmi all
|
|||
|
||||
```
|
||||
args:
|
||||
- NEXT_PUBLIC_API_URL=http://127.0.0.1:3001/api
|
||||
- NEXT_PUBLIC_WS_URL=ws://127.0.0.1:3001
|
||||
- BACKEND_API_URL=http://127.0.0.1:3001/api
|
||||
- BACKEND_WS_URL=ws://127.0.0.1:3001
|
||||
```
|
||||
|
||||
6. Save and close the `docker-compose.yaml` file
|
||||
|
@ -58,8 +58,8 @@ nano docker-compose.yaml
|
|||
|
||||
```
|
||||
args:
|
||||
- NEXT_PUBLIC_API_URL=http://127.0.0.1:3001/api
|
||||
- NEXT_PUBLIC_WS_URL=ws://127.0.0.1:3001
|
||||
- BACKEND_API_URL=http://127.0.0.1:3001/api
|
||||
- BACKEND_WS_URL=ws://127.0.0.1:3001
|
||||
```
|
||||
|
||||
6. Save and exit the editor
|
||||
|
@ -96,8 +96,8 @@ nano docker-compose.yaml
|
|||
|
||||
```
|
||||
args:
|
||||
- NEXT_PUBLIC_API_URL=http://127.0.0.1:3001/api
|
||||
- NEXT_PUBLIC_WS_URL=ws://127.0.0.1:3001
|
||||
- BACKEND_API_URL=http://127.0.0.1:3001/api
|
||||
- BACKEND_WS_URL=ws://127.0.0.1:3001
|
||||
```
|
||||
|
||||
6. Save and exit the editor
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
NEXT_PUBLIC_WS_URL=ws://localhost:3001
|
||||
NEXT_PUBLIC_API_URL=http://localhost:3001/api
|
||||
BACKEND_WS_URL=ws://localhost:3001
|
||||
BACKEND_API_URL=http://localhost:3001/api
|
|
@ -22,7 +22,7 @@ const Page = () => {
|
|||
const fetchChats = async () => {
|
||||
setLoading(true);
|
||||
|
||||
const res = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/chats`, {
|
||||
const res = await fetch(`${process.env.BACKEND_API_URL}/chats`, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
|
|
|
@ -40,7 +40,7 @@ const useSocket = (
|
|||
);
|
||||
|
||||
const providers = await fetch(
|
||||
`${process.env.NEXT_PUBLIC_API_URL}/models`,
|
||||
`${process.env.BACKEND_API_URL}/models`,
|
||||
{
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
|
@ -221,7 +221,7 @@ const loadMessages = async (
|
|||
setNotFound: (notFound: boolean) => void,
|
||||
) => {
|
||||
const res = await fetch(
|
||||
`${process.env.NEXT_PUBLIC_API_URL}/chats/${chatId}`,
|
||||
`${process.env.BACKEND_API_URL}/chats/${chatId}`,
|
||||
{
|
||||
method: 'GET',
|
||||
headers: {
|
||||
|
@ -272,7 +272,7 @@ const ChatWindow = ({ id }: { id?: string }) => {
|
|||
|
||||
const [isWSReady, setIsWSReady] = useState(false);
|
||||
const ws = useSocket(
|
||||
process.env.NEXT_PUBLIC_WS_URL!,
|
||||
process.env.BACKEND_WS_URL!,
|
||||
setIsWSReady,
|
||||
setHasError,
|
||||
);
|
||||
|
|
|
@ -21,7 +21,7 @@ const DeleteChat = ({
|
|||
setLoading(true);
|
||||
try {
|
||||
const res = await fetch(
|
||||
`${process.env.NEXT_PUBLIC_API_URL}/chats/${chatId}`,
|
||||
`${process.env.BACKEND_API_URL}/chats/${chatId}`,
|
||||
{
|
||||
method: 'DELETE',
|
||||
headers: {
|
||||
|
|
|
@ -35,7 +35,7 @@ const SearchImages = ({
|
|||
const chatModel = localStorage.getItem('chatModel');
|
||||
|
||||
const res = await fetch(
|
||||
`${process.env.NEXT_PUBLIC_API_URL}/images`,
|
||||
`${process.env.BACKEND_API_URL}/images`,
|
||||
{
|
||||
method: 'POST',
|
||||
headers: {
|
||||
|
|
|
@ -48,7 +48,7 @@ const Searchvideos = ({
|
|||
const chatModel = localStorage.getItem('chatModel');
|
||||
|
||||
const res = await fetch(
|
||||
`${process.env.NEXT_PUBLIC_API_URL}/videos`,
|
||||
`${process.env.BACKEND_API_URL}/videos`,
|
||||
{
|
||||
method: 'POST',
|
||||
headers: {
|
||||
|
|
|
@ -89,7 +89,7 @@ const SettingsDialog = ({
|
|||
if (isOpen) {
|
||||
const fetchConfig = async () => {
|
||||
setIsLoading(true);
|
||||
const res = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/config`, {
|
||||
const res = await fetch(`${process.env.BACKEND_API_URL}/config`, {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
|
@ -149,7 +149,7 @@ const SettingsDialog = ({
|
|||
setIsUpdating(true);
|
||||
|
||||
try {
|
||||
await fetch(`${process.env.NEXT_PUBLIC_API_URL}/config`, {
|
||||
await fetch(`${process.env.BACKEND_API_URL}/config`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
|
|
|
@ -5,7 +5,7 @@ export const getSuggestions = async (chatHisory: Message[]) => {
|
|||
const chatModel = localStorage.getItem('chatModel');
|
||||
const chatModelProvider = localStorage.getItem('chatModelProvider');
|
||||
|
||||
const res = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/suggestions`, {
|
||||
const res = await fetch(`${process.env.BACKEND_API_URL}/suggestions`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
|
|
Loading…
Add table
Reference in a new issue