mirror of
https://github.com/strapi/strapi.git
synced 2025-12-27 23:24:03 +00:00
Merge branch 'master' into master
This commit is contained in:
commit
7e75679094
@ -157,6 +157,32 @@ $.ajax({
|
||||
});
|
||||
```
|
||||
|
||||
## User Object In Strapi Context
|
||||
The User object is available to successfully authenticated requests.
|
||||
|
||||
#### Usage
|
||||
- The authenticated `user` object is a property of `ctx.state`.
|
||||
|
||||
|
||||
```js
|
||||
create: async (ctx) => {
|
||||
|
||||
const { _id } = ctx.state.user
|
||||
|
||||
const depositObj = {
|
||||
...ctx.request.body,
|
||||
depositor: _id
|
||||
}
|
||||
|
||||
const data = await strapi.services.deposit.add(depositObj);
|
||||
|
||||
// Send 201 `created`
|
||||
ctx.created(data);
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
|
||||
## Email templates
|
||||
|
||||
[See the documentation on GitHub](https://github.com/strapi/strapi/blob/master/packages/strapi-plugin-users-permissions/docs/email-templates.md)
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
{
|
||||
"myCustomConfiguration": "This configuration is accessible through strapi.config.environments.development.myCustomConfiguration"
|
||||
"myCustomConfiguration": "This configuration is accessible through strapi.config.environments.production.myCustomConfiguration"
|
||||
}
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
"uri": "${process.env.DATABASE_URI || ''}",
|
||||
"host": "${process.env.DATABASE_HOST || '127.0.0.1'}",
|
||||
"port": "${process.env.DATABASE_PORT || 27017}",
|
||||
"database": "${process.env.DATABASE_NAME || 'production'}",
|
||||
"database": "${process.env.DATABASE_NAME || 'strapi-production'}",
|
||||
"username": "${process.env.DATABASE_USERNAME || ''}",
|
||||
"password": "${process.env.DATABASE_PASSWORD || ''}",
|
||||
"ssl": "${process.env.DATABASE_SSL || false}",
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
{
|
||||
"myCustomConfiguration": "This configuration is accessible through strapi.config.environments.development.myCustomConfiguration"
|
||||
"myCustomConfiguration": "This configuration is accessible through strapi.config.environments.staging.myCustomConfiguration"
|
||||
}
|
||||
20
packages/strapi-generate-new/files/config/environments/staging/database.json
Executable file
20
packages/strapi-generate-new/files/config/environments/staging/database.json
Executable file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"defaultConnection": "default",
|
||||
"connections": {
|
||||
"default": {
|
||||
"connector": "strapi-mongoose",
|
||||
"settings": {
|
||||
"client": "mongo",
|
||||
"uri": "${process.env.DATABASE_URI || ''}",
|
||||
"host": "${process.env.DATABASE_HOST || '127.0.0.1'}",
|
||||
"port": "${process.env.DATABASE_PORT || 27017}",
|
||||
"database": "${process.env.DATABASE_NAME || 'strapi-staging'}",
|
||||
"username": "${process.env.DATABASE_USERNAME || ''}",
|
||||
"password": "${process.env.DATABASE_PASSWORD || ''}",
|
||||
"ssl": "${process.env.DATABASE_SSL || false}",
|
||||
"authenticationDatabase": "${process.env.DATABASE_AUTHENTICATION_DATABASE || ''}"
|
||||
},
|
||||
"options": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"gzip": {
|
||||
"enabled": false
|
||||
"enabled": true
|
||||
},
|
||||
"responseTime": {
|
||||
"enabled": false
|
||||
@ -1,35 +1,37 @@
|
||||
{
|
||||
"csrf": {
|
||||
"enabled": false,
|
||||
"enabled": true,
|
||||
"key": "_csrf",
|
||||
"secret": "_csrfSecret"
|
||||
},
|
||||
"csp": {
|
||||
"enabled": false,
|
||||
"policy": {
|
||||
"default-src": "'self'"
|
||||
}
|
||||
"enabled": true,
|
||||
"policy": [{
|
||||
"img-src": "'self' http:"
|
||||
},
|
||||
"block-all-mixed-content"
|
||||
]
|
||||
},
|
||||
"p3p": {
|
||||
"enabled": false,
|
||||
"enabled": true,
|
||||
"value": ""
|
||||
},
|
||||
"hsts": {
|
||||
"enabled": false,
|
||||
"enabled": true,
|
||||
"maxAge": 31536000,
|
||||
"includeSubDomains": true
|
||||
},
|
||||
"xframe": {
|
||||
"enabled": false,
|
||||
"enabled": true,
|
||||
"value": "SAMEORIGIN"
|
||||
},
|
||||
"xss": {
|
||||
"enabled": false,
|
||||
"enabled": true,
|
||||
"mode": "block"
|
||||
},
|
||||
"cors": {
|
||||
"enabled": false,
|
||||
"origin": "http://localhost",
|
||||
"enabled": true,
|
||||
"origin": "*",
|
||||
"expose": [
|
||||
"WWW-Authenticate",
|
||||
"Server-Authorization"
|
||||
@ -1,8 +1,8 @@
|
||||
{
|
||||
"host": "127.0.0.1",
|
||||
"port": 1337,
|
||||
"port": "${process.env.PORT || 1337}",
|
||||
"autoReload": {
|
||||
"enabled": true
|
||||
"enabled": false
|
||||
},
|
||||
"cron": {
|
||||
"enabled": false
|
||||
@ -1,19 +0,0 @@
|
||||
{
|
||||
"defaultConnection": "default",
|
||||
"connections": {
|
||||
"default": {
|
||||
"connector": "strapi-mongoose",
|
||||
"settings": {
|
||||
"client": "mongo",
|
||||
"host": "127.0.0.1",
|
||||
"port": 27017,
|
||||
"database": "test",
|
||||
"username": "",
|
||||
"password": "",
|
||||
"ssl": false,
|
||||
"authenticationDatabase": ""
|
||||
},
|
||||
"options": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user