Setting environment variables for Themekit

Solved
Highlighted
Tourist
8 1 0

Hi,

I'm using Themekit with Git. It's working fine but, since the recommendation is not to store the credentials in a GIT repository I decided to setup the environment variables in my config.yml file.

development:
  password: ${DEV_PASSWD}
  theme_id: ${DEV_THEMEID}
  store: ${DEV_SHOP}
  ignore_files:
      - "*.gif"
      - "*.jpg"
      - config/settings_data.json

As per instructions on https://shopify.github.io/themekit/configuration/#config-file 
I added a file called variables.env in C:\Users\MYUSERNAME\AppData\Shopify\Themekit with the credentials:

DEV_PASSWD=XXXXXXXXXXXXXXXXXXXXXXX
DEV_THEMEID=XXXXXXX
DEV_SHOP=demo-shop.myshopify.com

I also added the file to my Path environment variables on Windows 10.
However, it's not working, I'm getting the error:
invalid environment [development]: (missing store domain,missing password)
What am I doing wrong?

 

0 Likes
Excursionist
12 3 3

Hey there!

 

I had the same problem actually. The filename needs to be just `variables` with no `.env`.

 

Give that a shot.

1 Like

Success.

Excursionist
12 3 3

P.S. If this is more up your alley, you can add your `variables` file to the root of your project and gitignore that instead (this is my personal preference) :)

1 Like
Tourist
8 1 0
I had the same problem actually. The filename needs to be just `variables` with no `.env`.

Thank you for clearing that up. Unfortunately, it still throws me that error.

0 Likes
Excursionist
12 3 3

Try putting the `variables` file in your root.

 

If that works then it means we have been putting it in the wrong folder and it'll be a case of finding the correct directory to put it in.

0 Likes
Tourist
8 1 0

Indeed nichharp. It works in the root.

0 Likes
Excursionist
12 3 3

Did you find the hidden "AppData" folder or create it?

(for help on finding a hidden folder https://support.pointlogic.com/faq/troubleshooting/accessing-the-appdata-folder)

0 Likes

Success.

Excursionist
12 3 3

I'm on an ubuntu machine so I can't test what I'm recommending. So sorry about that. But it looks like Windows is weird so the folder might be wrong. It might have to be:

 

C:\\Users\\<User>\\AppData\\Roaming

(https://github.com/Shopify/themekit/issues/488#issuecomment-435061515)

1 Like
Tourist
8 1 0

Yes. Needs to be inside the Roaming folder, so C:\Users\username\AppData\Roaming\Shopify\Themekit.
It's working, thank you.

0 Likes
Excursionist
12 3 3

Awesome!! My pleasure, just glad it's working :D

0 Likes