I wanted to add the api proxy settings in my Volto app configuration.
This is possible in the src/config.js
. Between reading documentation and coming upon dead ends, it took me more than 30 minutes to find this.
According to the docs:
https://docs.voltocms.com/configuration/how-to/#extending-configuration-in-a-project
You must use an applyConfig
function
export default function applyConfig(config) {
config.settings = {
...config.settings,
devProxyToApiPath: 'http://192.168.0.3:11030/mysite'
};
return config;
}
Here's the contents of my final src/config.js
/**
* Add your config changes here.
* @module config
* @example
* export const settings = {
* ...defaultSettings,
* port: 4300,
* listBlockTypes: {
* ...defaultSettings.listBlockTypes,
* 'my-list-item',
* }
* }
*/
import {
settings as defaultSettings,
views as defaultViews,
widgets as defaultWidgets,
blocks as defaultBlocks,
addonReducers as defaultAddonReducers,
addonRoutes as defaultAddonRoutes,
} from '@plone/volto/config';
export const settings = {
...defaultSettings,
};
export const views = {
...defaultViews,
};
export const widgets = {
...defaultWidgets,
};
export const blocks = {
...defaultBlocks,
};
export const addonRoutes = [...defaultAddonRoutes];
export const addonReducers = { ...defaultAddonReducers };
export default function applyConfig(config) {
config.settings = {
...config.settings,
devProxyToApiPath: 'http://192.168.0.3::11030/mysite'
};
return config;
}
(of course you'll need to know what you are overriding. The things you can override are located under
your-volto-app/node_modules/@plone/volto/src/config/index.js
,
look for let config = {
near line 53 of the index.js file.
)