I’m confused in understanding environment setup for production and development.
So the file structures is:
- config
- env
- development
– database.js
– server.js - production
– database.js
my production is on gcloud and it’s running postgresql.
my development is local and from strapi quickstart so by default it’s sql
Production
This is a straight copy and paste from stapi documentation and all the credentials should be pulled from app.yaml
(I have ran npm install pg --save
in my local directory)
defaultConnection: 'default',
connections: {
default: {
connector: 'bookshelf',
settings: {
client: 'postgres',
host: `/cloudsql/${env('INSTANCE_CONNECTION_NAME')}`,
database: env('DATABASE_NAME'),
username: env('DATABASE_USERNAME'),
password: env('DATABASE_PASSWORD'),
},
options: {},
},
},
});
Development
this is a copy and paste from strapi quickstart install so nothing here has changed.
- Database.js:
defaultConnection: 'default',
connections: {
default: {
connector: 'bookshelf',
settings: {
client: 'sqlite',
filename: env('DATABASE_FILENAME', '.tmp/data.db'),
},
options: {
useNullAsDefault: true,
},
},
},
});
- server.js:
another copy and paste from strapi quickstart
host: env('HOST', '0.0.0.0'),
port: env.int('PORT', 1337),
admin: {
auth: {
secret: env('ADMIN_JWT_SECRET', '4fa1a37c43ba21c563d94193b359ec89'),
},
},
});
Now if I run strapi develop
the code will fail and I’m assuming it is because it can not find the path to local database. How do configure my folders and database.js files so I can run strapi locally and when I have made updates I can simply push the whole thing to gcloud and have it run off of postgres?
OS MacOS 10.15.7