mirror of
https://github.com/twentyhq/twenty.git
synced 2024-11-29 19:10:19 +03:00
736635a94b
We will remove the `twenty-postgres` image that was used for local development and only use `twenty-postgres-pilo` (which we use in prod), bringing the development environment closer to prod and avoiding having to maintain 2 images. Instead of provisioning the super user after the db initialization, we directly rely on the superuser provided by Spilo for simplicity. We also introduce a change that tries to create the right database (`default` or `test`) based on the context. How to test: ``` docker build -t twentycrm/twenty-postgres-spilo:latest -f ./packages/twenty-docker/twenty-postgres-spilo/Dockerfile . docker images --no-trunc | grep twenty-postgres-spilo postgres-on-docker: docker run \ --name twenty_pg \ -e PGUSER_SUPERUSER=twenty \ -e PGPASSWORD_SUPERUSER=twenty \ -e ALLOW_NOSSL=true \ -v twenty_db_data:/home/postgres/pgdata \ -p 5432:5432 \ REPLACE_WITH_IMAGE_ID ```
23 lines
691 B
TypeScript
23 lines
691 B
TypeScript
import * as fs from 'fs';
|
|
import path from 'path';
|
|
|
|
export const envVariables = (variables: string) => {
|
|
let payload = `
|
|
PG_DATABASE_URL=postgres://postgres:twenty@localhost:5432/default
|
|
FRONT_BASE_URL=http://localhost:3001
|
|
ACCESS_TOKEN_SECRET=replace_me_with_a_random_string_access
|
|
LOGIN_TOKEN_SECRET=replace_me_with_a_random_string_login
|
|
REFRESH_TOKEN_SECRET=replace_me_with_a_random_string_refresh
|
|
FILE_TOKEN_SECRET=replace_me_with_a_random_string_refresh
|
|
REDIS_URL=redis://localhost:6379
|
|
`;
|
|
payload = payload.concat(variables);
|
|
fs.writeFile(
|
|
path.join(__dirname, '..', '..', 'twenty-server', '.env'),
|
|
payload,
|
|
(err) => {
|
|
throw err;
|
|
},
|
|
);
|
|
};
|