@equinor/opt-serve
TypeScript icon, indicating that this package has built-in type declarations

6.15.0 • Public • Published

@equinor/opt-serve

License Downloads

Release Vulnerabilities

Nodejs server for OPT applications.

Production Server

In order to run a production server this package expects that the application is build using the dependency @equinor/opt-dev.

Once the application is build a production server can be start using the cli script:

// package.json
"scripts": {
    "start": "opt-serve"
}

Advanced Configuration

You can adjust various development and production settings by setting environment variables in your shell or with .env.

Note: To create custom environment variables, you must begin with REACT_APP_. Any other variables except NODE_ENV will be ignored to avoid accidentally exposing a private key on the machine that could have the same name. Changing any environment variables will require you to restart the development server if it is running.

The list of the environment variables are:

Base server configuration:

  • HTTPS: if the webpack must use https, only use it for development, false by default.
  • HOST: the host where to execute the application. 0.0.0.0 by default.
  • PORT: the port where to execute the application. 3000 by default.
  • COOKIE_SECRET: the cookie secret used by the express server, if non is provided it will generate a random one.
  • SESSION_SECRET: the session secret used by the express server, if non is provided it will generate a random one.
  • API_URL: the api url.

Active directory configuration:

  • ADAL_ENABLED: Deprecated Enable ADAL instead of MSAL, this option should not be used and is only there to keep backward compatibility. It will be removed in future versions.
  • AD_ROUTES_ENABLED: enable the Windows Azure Active Directory Authentication server routes. false by default.
  • AD_CLIENT_ID: the Azure Active Directory Authentication client id.
  • AD_CLIENT_SECRET: the Azure Active Directory Authentication client secret.
  • AD_TENANT: the Azure Active Directory Authentication tenant (dedicated and trusted Azure Active Directory's instance).
  • AD_RESOURCE: the Azure Active Directory Authentication resource.

Browser history:

  • HISTORY_API_MIDDLEWARE: Enable the history api middleware. Use it if you are using a BrowserHistory. false by default.

Azure Application Insights key:

  • APP_INSIGHTS_INSTRUMENTATION_KEY: Azure Application Insights key, see more on appinsights. This option is useful if you are using the skeleton from create-opt-app, if you are not using it, this option is probably useless and you can safely remove it.

Webpack configuration:

  • IMAGE_INLINE_SIZE_LIMIT: The limit to get the images using the url-loader. 10000 by default. By default, images smaller than 10,000 bytes are encoded as a data URI in base64 and inlined in the CSS or JS build artifact. Set this to control the size limit in bytes. Setting it to 0 will disable the inlining of images.
  • GENERATE_SOURCEMAP: if the webpack should generate the source map files when compile to production. true by default. When set to false, source maps are not generated for a production build. This solves out of memory (OOM) issues on some smaller machines.
  • INLINE_RUNTIME_CHUNK: If the runtime script need to be embed into to the index.html. true by default. By default, the runtime script will be embed into the index.html during the production build. When set to false, the script will not be embedded and will be imported as usual. This is normally required when dealing with CSP.
  • DISABLE_NEW_JSX_TRANSFORM: Disables the new JSX transform introduced in React 17 and backported to React 16.14.0, 15.7.0, and 0.14.10. false by default.
  • ESLINT_NO_DEV_ERRORS: if the webpack should emit errors as warnings. false by default. When set to true, ESLint errors are converted to warnings during development. As a result, ESLint output will no longer appear in the error overlay.
  • DISABLE_ESLINT_PLUGIN: Disable the eslint webpack plugin. false by default.
  • FAST_REFRESH: Whether or not react-refresh is enabled. true by default.

Readme

Keywords

none

Package Sidebar

Install

npm i @equinor/opt-serve

Weekly Downloads

40

Version

6.15.0

License

MIT

Unpacked Size

31.4 kB

Total Files

36

Last publish

Collaborators

  • sindremohr
  • spcttre
  • sbeno