From abf1283ab6113d3d00df8118ee883f558a3faa76 Mon Sep 17 00:00:00 2001 From: Shahed Nasser Date: Wed, 24 Apr 2024 19:01:11 +0300 Subject: [PATCH] docs: add details about the new host option of admin (#7142) --- www/apps/docs/content/admin/configuration.mdx | 43 ++++++++++++++++--- 1 file changed, 37 insertions(+), 6 deletions(-) diff --git a/www/apps/docs/content/admin/configuration.mdx b/www/apps/docs/content/admin/configuration.mdx index 653d625246..96327e0381 100644 --- a/www/apps/docs/content/admin/configuration.mdx +++ b/www/apps/docs/content/admin/configuration.mdx @@ -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: -```js title=medusa-config.js +```js title="medusa-config.js" const plugins = [ // ... { @@ -27,6 +27,7 @@ const plugins = [ develop: { open: true, port: 7001, + host: "example.com", logLevel: "error", stats: "normal", allowedHosts: "auto", @@ -109,6 +110,15 @@ const plugins = [ expandable: false, 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", 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 -### 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. - -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. +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. For example: -```js title=medusa-config.js +```js title="medusa-config.js" 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 :::note