Skip to content

Commit

Permalink
update BE
Browse files Browse the repository at this point in the history
  • Loading branch information
eraygundogmus committed Apr 25, 2022
1 parent 852bc48 commit 22aeecb
Show file tree
Hide file tree
Showing 17 changed files with 171 additions and 20 deletions.
16 changes: 12 additions & 4 deletions backend/config/database.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
const path = require('path');
const parse = require("pg-connection-string").parse;
const config = parse(process.env.DATABASE_URL);

module.exports = ({ env }) => ({
connection: {
client: 'sqlite',
client: "postgres",
connection: {
filename: path.join(__dirname, '..', env('DATABASE_FILENAME', '.tmp/data.db')),
host: config.host,
port: config.port,
database: config.database,
user: config.user,
password: config.password,
ssl: {
rejectUnauthorized: false,
},
},
useNullAsDefault: true,
debug: false,
},
});
17 changes: 17 additions & 0 deletions backend/config/env/production/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module.exports = ({ env }) => ({
// ...
upload: {
config: {
provider: "aws-s3",
providerOptions: {
accessKeyId: env("AWS_ACCESS_KEY_ID"),
secretAccessKey: env("AWS_ACCESS_SECRET"),
region: env("AWS_REGION"),
params: {
Bucket: env("AWS_BUCKET"),
},
},
},
},
// ...
});
45 changes: 35 additions & 10 deletions backend/config/middlewares.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,37 @@
module.exports = [
'strapi::errors',
'strapi::security',
'strapi::cors',
'strapi::poweredBy',
'strapi::logger',
'strapi::query',
'strapi::body',
'strapi::session',
'strapi::favicon',
'strapi::public',
"strapi::errors",
"strapi::security",
"strapi::cors",
"strapi::poweredBy",
"strapi::logger",
"strapi::query",
"strapi::body",
"strapi::session",
"strapi::favicon",
"strapi::public",

{
name: "strapi::security",
config: {
contentSecurityPolicy: {
useDefaults: true,
directives: {
"connect-src": ["'self'", "https:"],
"img-src": [
"'self'",
"data:",
"blob:",
"myblogawsbucket.s3.amazonaws.com",
],
"media-src": [
"'self'",
"data:",
"blob:",
"myblogawsbucket.s3.amazonaws.com",
],
upgradeInsecureRequests: null,
},
},
},
},
];
17 changes: 17 additions & 0 deletions backend/config/plugins.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module.exports = ({ env }) => ({
// ...
upload: {
config: {
provider: "aws-s3",
providerOptions: {
accessKeyId: env("AWS_ACCESS_KEY_ID"),
secretAccessKey: env("AWS_ACCESS_SECRET"),
region: env("AWS_REGION"),
params: {
Bucket: env("AWS_BUCKET"),
},
},
},
},
// ...
});
6 changes: 3 additions & 3 deletions backend/config/server.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = ({ env }) => ({
host: env('HOST', '0.0.0.0'),
port: env.int('PORT', 1337),
host: env("HOST", "0.0.0.0"),
port: env.int("PORT", 1337),
app: {
keys: env.array('APP_KEYS'),
keys: env.array("APP_KEYS"),
},
});
Binary file not shown.
Binary file removed backend/data/uploads/beautiful-picture.jpg
Binary file not shown.
Binary file removed backend/data/uploads/daviddoe@strapi.io.jpg
Binary file not shown.
Binary file removed backend/data/uploads/default-image.png
Binary file not shown.
Binary file removed backend/data/uploads/favicon.png
Binary file not shown.
Binary file removed backend/data/uploads/sarahbaker@strapi.io.jpg
Binary file not shown.
Binary file removed backend/data/uploads/the-internet-s-own-boy.jpg
Binary file not shown.
Binary file removed backend/data/uploads/this-shrimp-is-awesome.jpg
Binary file not shown.
Binary file removed backend/data/uploads/we-love-pizza.jpg
Binary file not shown.
Binary file removed backend/data/uploads/what-s-inside-a-black-hole.jpg
Binary file not shown.
1 change: 1 addition & 0 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"@strapi/plugin-graphql": "^4.0.0",
"@strapi/plugin-i18n": "4.1.8",
"@strapi/plugin-users-permissions": "4.1.8",
"@strapi/provider-upload-aws-s3": "^4.1.8",
"@strapi/strapi": "4.1.8",
"better-sqlite3": "7.4.6",
"lodash.set": "^4.3.2",
Expand Down
89 changes: 86 additions & 3 deletions backend/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1868,6 +1868,14 @@
"@strapi/utils" "4.1.8"
sendmail "^1.6.1"

"@strapi/provider-upload-aws-s3@^4.1.8":
version "4.1.8"
resolved "https://registry.yarnpkg.com/@strapi/provider-upload-aws-s3/-/provider-upload-aws-s3-4.1.8.tgz#37e8d903db206e6e7efef76196798ad6eadfa29f"
integrity sha512-D3RtHwHiXN5li1DXTvcaiI4weftnyO+Z7IOTBtLaOUGYA/WOm5QadtyXiOhGmQDohBkMH3MNniY2LJVl4Ou78A==
dependencies:
aws-sdk "2.892.0"
lodash "4.17.21"

"@strapi/provider-upload-local@4.1.8":
version "4.1.8"
resolved "https://registry.npmjs.org/@strapi/provider-upload-local/-/provider-upload-local-4.1.8.tgz"
Expand Down Expand Up @@ -2929,6 +2937,21 @@ available-typed-arrays@^1.0.5:
resolved "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz"
integrity sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==

aws-sdk@2.892.0:
version "2.892.0"
resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.892.0.tgz#adec48f52f4b6f5c576dcbfac020bcec1eed3a25"
integrity sha512-OOXJ15AnJJMHZYXJQVy22Wjnp5GrZCfvCxmoZuXdsLNs8M+BL4mfBqma82+UkM2NhJgLYuAhDfvFUBob6VGIWw==
dependencies:
buffer "4.9.2"
events "1.1.1"
ieee754 "1.1.13"
jmespath "0.15.0"
querystring "0.2.0"
sax "1.2.1"
url "0.10.3"
uuid "3.3.2"
xml2js "0.4.19"

aws-sign2@~0.7.0:
version "0.7.0"
resolved "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz"
Expand Down Expand Up @@ -3039,7 +3062,7 @@ balanced-match@^1.0.0:
resolved "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz"
integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==

base64-js@^1.3.1:
base64-js@^1.0.2, base64-js@^1.3.1:
version "1.5.1"
resolved "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz"
integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==
Expand Down Expand Up @@ -3348,6 +3371,15 @@ buffer-xor@^1.0.3:
resolved "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz"
integrity sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=

buffer@4.9.2:
version "4.9.2"
resolved "https://registry.yarnpkg.com/buffer/-/buffer-4.9.2.tgz#230ead344002988644841ab0244af8c44bbe3ef8"
integrity sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg==
dependencies:
base64-js "^1.0.2"
ieee754 "^1.1.4"
isarray "^1.0.0"

buffer@^5.1.0, buffer@^5.5.0, buffer@^5.6.0:
version "5.7.1"
resolved "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz"
Expand Down Expand Up @@ -4954,6 +4986,11 @@ eventemitter3@^4.0.0:
resolved "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz"
integrity sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==

events@1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/events/-/events-1.1.1.tgz#9ebdb7635ad099c70dcc4c2a1f5004288e8bd924"
integrity sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ=

events@^3.2.0, events@^3.3.0:
version "3.3.0"
resolved "https://registry.npmjs.org/events/-/events-3.3.0.tgz"
Expand Down Expand Up @@ -6028,7 +6065,12 @@ icss-utils@^5.0.0, icss-utils@^5.1.0:
resolved "https://registry.npmjs.org/icss-utils/-/icss-utils-5.1.0.tgz"
integrity sha512-soFhflCVWLfRNOPU3iv5Z9VUdT44xFRbzjLsEzSr5AQmgqPMTHdU3PMT1Cf1ssx8fLNJDA1juftYl+PUcv3MqA==

ieee754@^1.1.13, ieee754@^1.2.1:
ieee754@1.1.13:
version "1.1.13"
resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.13.tgz#ec168558e95aa181fd87d37f55c32bbcb6708b84"
integrity sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==

ieee754@^1.1.13, ieee754@^1.1.4, ieee754@^1.2.1:
version "1.2.1"
resolved "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz"
integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==
Expand Down Expand Up @@ -6569,7 +6611,7 @@ isarray@0.0.1:
resolved "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz"
integrity sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=

isarray@1.0.0, isarray@~1.0.0:
isarray@1.0.0, isarray@^1.0.0, isarray@~1.0.0:
version "1.0.0"
resolved "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz"
integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=
Expand Down Expand Up @@ -6615,6 +6657,11 @@ jest-worker@^27.4.5:
merge-stream "^2.0.0"
supports-color "^8.0.0"

jmespath@0.15.0:
version "0.15.0"
resolved "https://registry.yarnpkg.com/jmespath/-/jmespath-0.15.0.tgz#a3f222a9aae9f966f5d27c796510e28091764217"
integrity sha1-o/Iiqarp+Wb10nx5ZRDigJF2Qhc=

joycon@^3.0.1:
version "3.1.1"
resolved "https://registry.npmjs.org/joycon/-/joycon-3.1.1.tgz"
Expand Down Expand Up @@ -9444,6 +9491,16 @@ saslprep@^1.0.0:
dependencies:
sparse-bitfield "^3.0.3"

sax@1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.1.tgz#7b8e656190b228e81a66aea748480d828cd2d37a"
integrity sha1-e45lYZCyKOgaZq6nSEgNgozS03o=

sax@>=0.6.0:
version "1.2.4"
resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9"
integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==

scheduler@^0.20.2:
version "0.20.2"
resolved "https://registry.npmjs.org/scheduler/-/scheduler-0.20.2.tgz"
Expand Down Expand Up @@ -10546,6 +10603,14 @@ url-join@4.0.1:
resolved "https://registry.npmjs.org/url-join/-/url-join-4.0.1.tgz"
integrity sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA==

url@0.10.3:
version "0.10.3"
resolved "https://registry.yarnpkg.com/url/-/url-0.10.3.tgz#021e4d9c7705f21bbf37d03ceb58767402774c64"
integrity sha1-Ah5NnHcF8hu/N9A861h2dAJ3TGQ=
dependencies:
punycode "1.3.2"
querystring "0.2.0"

url@^0.11.0:
version "0.11.0"
resolved "https://registry.npmjs.org/url/-/url-0.11.0.tgz"
Expand Down Expand Up @@ -10591,6 +10656,11 @@ utils-merge@1.0.1:
resolved "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz"
integrity sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=

uuid@3.3.2:
version "3.3.2"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131"
integrity sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==

uuid@^3.3.2:
version "3.4.0"
resolved "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz"
Expand Down Expand Up @@ -10961,6 +11031,19 @@ xdg-basedir@^4.0.0:
resolved "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-4.0.0.tgz"
integrity sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==

xml2js@0.4.19:
version "0.4.19"
resolved "https://registry.yarnpkg.com/xml2js/-/xml2js-0.4.19.tgz#686c20f213209e94abf0d1bcf1efaa291c7827a7"
integrity sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==
dependencies:
sax ">=0.6.0"
xmlbuilder "~9.0.1"

xmlbuilder@~9.0.1:
version "9.0.7"
resolved "https://registry.yarnpkg.com/xmlbuilder/-/xmlbuilder-9.0.7.tgz#132ee63d2ec5565c557e20f4c22df9aca686b10d"
integrity sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0=

xss@^1.0.6, xss@^1.0.8:
version "1.0.11"
resolved "https://registry.npmjs.org/xss/-/xss-1.0.11.tgz"
Expand Down

1 comment on commit 22aeecb

@vercel
Copy link

@vercel vercel bot commented on 22aeecb Apr 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.