Skip to content

Commit

Permalink
Upgrade to Strapi v4 (render-examples#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
crcastle authored Mar 25, 2022
1 parent ff4d219 commit a078fee
Show file tree
Hide file tree
Showing 20 changed files with 4,528 additions and 4,412 deletions.
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
HOST=0.0.0.0
PORT=1337
APP_KEYS=tempkey
JWT_SECRET=tempsecret
ADMIN_JWT_SECRET=tempsecret
5 changes: 5 additions & 0 deletions config/admin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = ({ env }) => ({
auth: {
secret: env('ADMIN_JWT_SECRET', 'b4dbad35-6caa-4f84-be56-90d0d3bc2fdf'),
},
});
18 changes: 7 additions & 11 deletions config/database.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
const path = require('path');

module.exports = ({ env }) => ({
defaultConnection: 'default',
connections: {
default: {
connector: 'bookshelf',
settings: {
client: 'sqlite',
filename: env('DATABASE_FILENAME', '.tmp/data.db'),
},
options: {
useNullAsDefault: true,
},
connection: {
client: 'sqlite',
connection: {
filename: env('DATABASE_FILENAME', path.join(__dirname, '..', '.tmp/data.db')),
},
useNullAsDefault: true,
},
});
10 changes: 0 additions & 10 deletions config/env/production/middleware.js

This file was deleted.

6 changes: 0 additions & 6 deletions config/env/production/server.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
module.exports = ({ env }) => ({
host: "0.0.0.0",
url: env("RENDER_EXTERNAL_URL"),
admin: {
auth: {
secret: env("ADMIN_JWT_SECRET"),
},
},
});
13 changes: 0 additions & 13 deletions config/functions/bootstrap.js

This file was deleted.

21 changes: 0 additions & 21 deletions config/functions/cron.js

This file was deleted.

5 changes: 0 additions & 5 deletions config/functions/responses/404.js

This file was deleted.

12 changes: 12 additions & 0 deletions config/middlewares.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = [
"strapi::errors",
"strapi::security",
"strapi::cors",
"strapi::poweredBy",
"strapi::logger",
"strapi::query",
"strapi::body",
'strapi::session',
"strapi::favicon",
"strapi::public",
];
6 changes: 2 additions & 4 deletions config/server.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
module.exports = ({ env }) => ({
host: env('HOST', '0.0.0.0'),
port: env.int('PORT', 1337),
admin: {
auth: {
secret: env('ADMIN_JWT_SECRET', '02c8ae6aa94de991b9df3d7be1b2dd90'),
},
app: {
keys: env.array('APP_KEYS')
},
});
3 changes: 0 additions & 3 deletions extensions/users-permissions/config/jwt.js

This file was deleted.

15 changes: 4 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,10 @@
},
"devDependencies": {},
"dependencies": {
"knex": "<0.20.0",
"sqlite3": "latest",
"strapi": "3.4.5",
"strapi-admin": "3.4.5",
"strapi-connector-bookshelf": "3.4.5",
"strapi-plugin-content-manager": "3.4.5",
"strapi-plugin-content-type-builder": "3.4.5",
"strapi-plugin-email": "3.4.5",
"strapi-plugin-upload": "3.4.5",
"strapi-plugin-users-permissions": "3.4.5",
"strapi-utils": "3.4.5"
"@strapi/plugin-i18n": "4.1.3",
"@strapi/strapi": "4.1.3",
"@strapi/plugin-users-permissions": "4.1.3",
"sqlite3": "^5.0.2"
},
"author": {
"name": "A Strapi developer"
Expand Down
4 changes: 3 additions & 1 deletion render.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ services:
sizeGB: 1
envVars:
- key: NODE_VERSION
value: 12.18.4
value: ~16.13.0
- key: NODE_ENV
value: production
- key: DATABASE_FILENAME
Expand All @@ -21,3 +21,5 @@ services:
generateValue: true
- key: ADMIN_JWT_SECRET
generateValue: true
- key: APP_KEYS
generateValue: true
35 changes: 35 additions & 0 deletions src/admin/app.example.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
export default {
config: {
locales: [
// 'ar',
// 'fr',
// 'cs',
// 'de',
// 'dk',
// 'es',
// 'he',
// 'id',
// 'it',
// 'ja',
// 'ko',
// 'ms',
// 'nl',
// 'no',
// 'pl',
// 'pt-BR',
// 'pt',
// 'ru',
// 'sk',
// 'sv',
// 'th',
// 'tr',
// 'uk',
// 'vi',
// 'zh-Hans',
// 'zh',
],
},
bootstrap(app) {
console.log(app);
},
};
9 changes: 9 additions & 0 deletions src/admin/webpack.config.example.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use strict';

/* eslint-disable no-unused-vars */
module.exports = (config, webpack) => {
// Note: we provide webpack above so you should not `require` it
// Perform customizations to webpack config
// Important: return the modified config
return config;
};
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions src/extensions/user-permissions/jwt.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
jwtSecret: process.env.JWT_SECRET || '29acc8bd-955a-48d8-9475-4d52c7a97462'
};
20 changes: 20 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
'use strict';

module.exports = {
/**
* An asynchronous register function that runs before
* your application is initialized.
*
* This gives you an opportunity to extend code.
*/
register(/*{ strapi }*/) {},

/**
* An asynchronous bootstrap function that runs before
* your application gets started.
*
* This gives you an opportunity to set up your data model,
* run jobs, or perform some special logic.
*/
bootstrap(/*{ strapi }*/) {},
};
Loading

0 comments on commit a078fee

Please sign in to comment.