Merge branch 'front/dz-post-data' of github.com:strapi/strapi into ctb/events

This commit is contained in:
soupette 2019-12-12 16:37:23 +01:00
commit 6c62e7c481
3 changed files with 43 additions and 3 deletions

View File

@ -25,6 +25,25 @@ By default, the administration panel is exposed via [http://localhost:1337/admin
} }
``` ```
## Change the host
By default, the administration panel client host name is `localhost`. However, you can change this setting by updating the `admin` configuration:
**Path —** `./config/environment/**/server.json`.
```json
{
"host": "localhost",
"port": 1337,
"cron": {
"enabled": false
},
"admin": {
"host": "my-host"
}
}
```
The panel will be available through [http://localhost:1337/dashboard](http://localhost:1337/dashboard) with the configurations above. The panel will be available through [http://localhost:1337/dashboard](http://localhost:1337/dashboard) with the configurations above.
## Development mode ## Development mode
@ -170,6 +189,25 @@ Add the following configuration:
export const SHOW_TUTORIALS = false; export const SHOW_TUTORIALS = false;
``` ```
### Changing the port
By default, the front-development server runs on the `8000` port. However, you can change this setting by updating the following configuration:
**Path —** `./config/environment/**/server.json`.
```json
{
"host": "localhost",
"port": 1337,
"cron": {
"enabled": false
},
"admin": {
"port": 3000
}
}
```
## Build ## Build
To build the administration, run the following command from the root directory of your project. To build the administration, run the following command from the root directory of your project.

View File

@ -199,7 +199,7 @@ async function build({ dir, env, options, optimize }) {
}); });
} }
async function watchAdmin({ dir, port, options }) { async function watchAdmin({ dir, host, port, options }) {
// Create the cache dir containing the front-end files. // Create the cache dir containing the front-end files.
await createCacheDir(dir); await createCacheDir(dir);
@ -228,7 +228,7 @@ async function watchAdmin({ dir, port, options }) {
const server = new WebpackDevServer(webpack(getWebpackConfig(args)), opts); const server = new WebpackDevServer(webpack(getWebpackConfig(args)), opts);
server.listen(port, 'localhost', function(err) { server.listen(port, host, function(err) {
if (err) { if (err) {
console.log(err); console.log(err);
} }
@ -237,7 +237,7 @@ async function watchAdmin({ dir, port, options }) {
console.log(); console.log();
console.log( console.log(
chalk.green( chalk.green(
`Admin development at http://localhost:${port}${opts.publicPath}` `Admin development at http://${host}:${port}${opts.publicPath}`
) )
); );
}); });

View File

@ -14,6 +14,7 @@ module.exports = async function() {
const port = _.get(serverConfig, 'port', 1337); const port = _.get(serverConfig, 'port', 1337);
const host = _.get(serverConfig, 'host', 'localhost'); const host = _.get(serverConfig, 'host', 'localhost');
const adminPort = _.get(serverConfig, 'admin.port', 8000); const adminPort = _.get(serverConfig, 'admin.port', 8000);
const adminHost = _.get(serverConfig, 'admin.host', 'localhost');
const adminBackend = _.get( const adminBackend = _.get(
serverConfig, serverConfig,
'admin.build.backend', 'admin.build.backend',
@ -24,6 +25,7 @@ module.exports = async function() {
strapiAdmin.watchAdmin({ strapiAdmin.watchAdmin({
dir, dir,
port: adminPort, port: adminPort,
host: adminHost,
options: { options: {
backend: adminBackend, backend: adminBackend,
publicPath: addSlash(adminPath), publicPath: addSlash(adminPath),