Redirect
This commit is contained in:
@@ -18,7 +18,12 @@ func main() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Error loading .env file: %v", err)
|
log.Fatalf("Error loading .env file: %v", err)
|
||||||
}
|
}
|
||||||
|
environ := os.Getenv("ENVIRONMENT")
|
||||||
port := os.Getenv("BACKEND_DOCKER_PORT")
|
port := os.Getenv("BACKEND_DOCKER_PORT")
|
||||||
|
if environ == "DEV" {
|
||||||
|
port = os.Getenv("BACKEND_PORT")
|
||||||
|
}
|
||||||
|
|
||||||
http.HandleFunc("/", handler)
|
http.HandleFunc("/", handler)
|
||||||
fmt.Printf("Serving on port %s\n", port)
|
fmt.Printf("Serving on port %s\n", port)
|
||||||
err = http.ListenAndServe(fmt.Sprintf(":%s", port), nil)
|
err = http.ListenAndServe(fmt.Sprintf(":%s", port), nil)
|
||||||
|
|||||||
13
docker-compose.dev.yaml
Normal file
13
docker-compose.dev.yaml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
services:
|
||||||
|
psql:
|
||||||
|
container_name: latosa-database
|
||||||
|
image: postgres:17.2-alpine
|
||||||
|
restart: always
|
||||||
|
env_file: .env
|
||||||
|
ports:
|
||||||
|
- ${POSTGRES_PORT}:${POSTGRES_DOCKER_PORT}
|
||||||
|
volumes:
|
||||||
|
- le-data:/var/lib/postgresql/data
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
le-data:
|
||||||
@@ -3,6 +3,15 @@ import type { NextConfig } from "next";
|
|||||||
const nextConfig: NextConfig = {
|
const nextConfig: NextConfig = {
|
||||||
/* config options here */
|
/* config options here */
|
||||||
output: "standalone",
|
output: "standalone",
|
||||||
|
async redirects() {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
destination: "/api",
|
||||||
|
source: `http://localhost:${process.env.BACKEND_PORT}`,
|
||||||
|
permanent: true,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export default nextConfig;
|
export default nextConfig;
|
||||||
|
|||||||
2
init.sh
2
init.sh
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/sh
|
#!/usr/bin/sh
|
||||||
printf "POSTGRES_USER=\nPOSTGRES_PASSWORD=\nPOSTGRES_DB=\n#\nDocker\ninner\nport\ncontainer\nPOSTGRES_DOCKER_PORT=5432\nBACKEND_DOCKER_PORT=3000\nFRONTEND_DOCKER_PORT=3000\nPOSTGRES_PORT=5432\nBACKEND_PORT=3001\nFRONTEND_PORT=3000\n" > .env
|
printf "ENVIRONMENT=DEV\nPOSTGRES_USER=\nPOSTGRES_PASSWORD=\nPOSTGRES_DB=\n#\nDocker\ninner\nport\ncontainer\nPOSTGRES_DOCKER_PORT=5432\nBACKEND_DOCKER_PORT=3000\nFRONTEND_DOCKER_PORT=3000\nPOSTGRES_PORT=5432\nBACKEND_PORT=3001\nFRONTEND_PORT=3000\n" > .env
|
||||||
ln $(pwd)/.env $(pwd)/backend
|
ln $(pwd)/.env $(pwd)/backend
|
||||||
ln $(pwd)/.env $(pwd)/frontend
|
ln $(pwd)/.env $(pwd)/frontend
|
||||||
|
|||||||
Reference in New Issue
Block a user