Skip to content
Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
32 lines (22 sloc) 877 Bytes

Environment Variables

When building web applications usually the same application needs to working in different environments (development, staging, production). There are some variables like API endpoints that are different between these environments.

Mint offers a simple feature for managing these variables. You can create different files .env .env.production which have contents like this:

ENDPOINT=http://localhost:3001
WSENDPOINT=ws://localhost:3001

Then in Mint code you can inline them:

component Main {
  fun render : Html {
    <div>  
      <{ @ENDPOINT }>
    </div>
  }
}

Specifying .env file

The Mint CLI has a global flab -e or --env which takes the path to the .env file:

mint start --env .env.production
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.