Socket
Book a DemoInstallSign in
Socket

@staticdeploy/app-config

Package Overview
Dependencies
Maintainers
3
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@staticdeploy/app-config

Configuration for static apps

latest
Source
npmnpm
Version
2.0.2
Version published
Maintainers
3
Created
Source

npm version build status coverage status dependency status devDependency status

app-config

A tool for generating configuration files for static apps.

Install

yarn add @staticdeploy/app-config

Quickstart

  • add the following <script> to your public/index.html:

    <script id="app-config" src="http://localhost:3456/app-config.js"></script>
    
  • access the config variable in your code:

    console.log(window.APP_CONFIG.MY_VAR);
    

Then:

In development

  • define configuration in the .env file:

    APP_CONFIG_MY_VAR=my_val
    
  • start the development server with $(npm bin)/dev-config-server

In production

  • build your app and get the path of the app's index.html (for example, for apps built with create-react-app the path is build/index.html)

  • defining configuration via environment variables:

    export APP_CONFIG_MY_VAR=my_val
    
  • inject the configuration into the index file by running:

    $(npm bin)/inject-config --file path/to/index.html
    

Additional documentation

FAQs

Package last updated on 28 Aug 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts