Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add automatic environment variable loading and Variables in yml config. #589

Merged
merged 3 commits into from Nov 1, 2018

Conversation

tanema
Copy link
Contributor

@tanema tanema commented Oct 15, 2018

Features

This PR encapsulates 2 main features.

  • Automatically load environment variables from a file during runtime
  • Allow environment variable interpolation in the config

This will allow developers to much more easily commit their code to public repos without revealing their passwords or their clients.

Environment variable loading

The normal user configuration paths are used so depending on OS the path used would be:
Windows: %APPDATA%\Shopify\Themekit\variables
Linux/BSDs: ${XDG_CONFIG_HOME}/Shopify/Themekit/variables
MacOSX: ${HOME}/Library/Application Support/Shopify/Themekit/variables

Themekit will also look for a variables file within the project directory. There has also been a flag added --vars will provide a path to a variables file.

The format of these files would look like a normal .env file:

DEV_PASSWD=0bwef09hn23048sdkl2345n2k3

Config file interpolation.

The config looks would like this:

development:
  password: ${DEV_PASSWD}
  theme_id: ${DEV_THEMEID}
  store: ${DEV_SHOP}

and the commands can be run as normal. This will not add any breaking functionality and should not break any existing workflows

Warn Checklist

  • This changes the interface and requires a Major/Minor version change.
  • I have 🎩'd these changes by using the commands I changed by hand.
  • I have added a dependancy to the project.

@tanema tanema changed the title Expand env vars in yaml config so that env vars can be used more flexibly Expand env vars in yaml config and use a dotenv Oct 22, 2018
@tanema
Copy link
Contributor Author

tanema commented Oct 30, 2018

use https://github.com/shibukawa/configdir for finding the config dir
use https://github.com/alexsasharegan/dotenv for loading a dotenv file

@tanema tanema changed the title Expand env vars in yaml config and use a dotenv Add automatic environment variable loading and Variables in yml config. Oct 31, 2018
@tanema tanema merged commit 50a3e9d into master Nov 1, 2018
@tanema tanema deleted the expand_config_vars branch November 1, 2018 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant