docs: add details about the new host option of admin (#7142)
This commit is contained in:
@@ -12,7 +12,7 @@ In this document, you'll learn about the different ways you can configure the ad
|
|||||||
|
|
||||||
The plugin accepts the following options:
|
The plugin accepts the following options:
|
||||||
|
|
||||||
```js title=medusa-config.js
|
```js title="medusa-config.js"
|
||||||
const plugins = [
|
const plugins = [
|
||||||
// ...
|
// ...
|
||||||
{
|
{
|
||||||
@@ -27,6 +27,7 @@ const plugins = [
|
|||||||
develop: {
|
develop: {
|
||||||
open: true,
|
open: true,
|
||||||
port: 7001,
|
port: 7001,
|
||||||
|
host: "example.com",
|
||||||
logLevel: "error",
|
logLevel: "error",
|
||||||
stats: "normal",
|
stats: "normal",
|
||||||
allowedHosts: "auto",
|
allowedHosts: "auto",
|
||||||
@@ -109,6 +110,15 @@ const plugins = [
|
|||||||
expandable: false,
|
expandable: false,
|
||||||
children: []
|
children: []
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "host",
|
||||||
|
type: "string",
|
||||||
|
optional: true,
|
||||||
|
defaultValue: "localhost",
|
||||||
|
description: "The host of the backend. This is useful if you're running a development server remotely.",
|
||||||
|
expandable: false,
|
||||||
|
children: []
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "logLevel",
|
name: "logLevel",
|
||||||
type: "\"error\" \\| \"none\" \\| \"warn\" \\| \"info\" \\| \"log\" \\| \"verbose\"",
|
type: "\"error\" \\| \"none\" \\| \"warn\" \\| \"info\" \\| \"log\" \\| \"verbose\"",
|
||||||
@@ -238,15 +248,13 @@ You can add the following options to the `medusa-admin develop` command:
|
|||||||
|
|
||||||
## Change Backend URL
|
## Change Backend URL
|
||||||
|
|
||||||
### In Development
|
### In Development - Disabled Serve
|
||||||
|
|
||||||
To change the backend's URL that the admin sends request to in development, you must disable the `serve` plugin option and set the `backend` option to the URL of your Medusa backend.
|
To change the backend's URL that the admin sends request to in development when the `serve` option is disabled, set the `backend` option to the URL of your Medusa backend.
|
||||||
|
|
||||||
However, this requires you to also set-up the [develop command](#develop-command-options) as the admin will no longer start with the Medusa backend.
|
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
```js title=medusa-config.js
|
```js title="medusa-config.js"
|
||||||
const plugins = [
|
const plugins = [
|
||||||
// ...
|
// ...
|
||||||
{
|
{
|
||||||
@@ -261,6 +269,29 @@ const plugins = [
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### In Development - Enabled Serve
|
||||||
|
|
||||||
|
To change the backend's URL when the `serve` option is enabled, set the `host` and `port` properties of the `develop` option to those of the Medusa backend. This is useful when running Medusa remotely in development, such as using GitHub Codespace.
|
||||||
|
|
||||||
|
For example:
|
||||||
|
|
||||||
|
```js title="medusa-config.js"
|
||||||
|
const plugins = [
|
||||||
|
// ...
|
||||||
|
{
|
||||||
|
resolve: "@medusajs/admin",
|
||||||
|
/** @type {import('@medusajs/admin').PluginOptions} */
|
||||||
|
options: {
|
||||||
|
// other options...
|
||||||
|
develop: {
|
||||||
|
port: 7000,
|
||||||
|
host: "example.com",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
### In Production
|
### In Production
|
||||||
|
|
||||||
:::note
|
:::note
|
||||||
|
|||||||
Reference in New Issue
Block a user