Skip to content

Instantly share code, notes, and snippets.

View MattieBelt's full-sized avatar
🐜
Looking for ants

Mattias van den Belt MattieBelt

🐜
Looking for ants
View GitHub Profile
@MattieBelt
MattieBelt / create-multiple-postgresql-databases.sh
Last active October 13, 2021 14:36
Strapi docker-compose (multiple databases for multiple envs)
#!/bin/bash
# This file should be located at:
# `my-project/docker-compose-init/create-multiple-postgresql-databases.sh`
# https://github.com/mrts/docker-postgresql-multiple-databases
set -e
set -u
@MattieBelt
MattieBelt / database.js
Created October 13, 2021 14:20
Strapi docker-compose
module.exports = ({ env }) => ({
defaultConnection: 'default',
connections: {
default: {
connector: 'bookshelf',
settings: {
client: 'postgres',
host: env('DATABASE_HOST', 'localhost'),
port: env('DATABASE_PORT', 5432),
database: env('DATABASE_NAME', 'strapi'),
const { sanitizeEntity } = require('strapi-utils');
module.exports = {
async upload(ctx) {
const {
request: { files: { files } = {} },
} = ctx;
const uploadedFiles = await strapi.plugins.upload.services.upload.upload({
data: {},
@MattieBelt
MattieBelt / hook.js
Last active July 2, 2020 19:27
Strapi stable 3.0.x Algolia hook workaround
// config/hook.js
module.exports = {
settings: {
"timeout": 3000,
"load": {
"before": [],
"order": [
"Define the hooks' load order by putting their names in this array in the right order"
],
const es = require('./es');
const en = require('./en');
const newKeys = Object.keys(en).filter(x => !Object.keys(es).includes(x));
newKeys.forEach(key => {
es[key] = en[key];
});
console.log(es);

Commit message

  • Separate subject from body with a blank line
  • Limit the subject line to 50 characters
  • Capitalize the subject line
  • Do not end the subject line with a period
  • Use the imperative mood in the subject line
    • If applied, this commit will ...
  • Wrap the body at 72 characters
  • Use the body to explain what and why vs how