How to use environments (shopify.theme.toml)?

iamkeir
Shopify Partner
205 0 41

Hi folks,

 

I am puzzled by the documentation on using environments with Shopify CLI.

 

Say I have two separate shops/projects, both in their own repository/folder locally. I place a `shopify.theme.toml` file in each, with:

[environments.default]
store = "my-shop"
password = "XXXXX"

My expectation was then that when I run `shopify theme dev`, it will identify the environment and run it. However, it runs whatever the last shop/environment I was using `shopify theme dev` with, which may not be the current project folder I'm in.

 

I know I can run `shopify theme dev --environment default` but I don't want to have to remember to do that every time, and it is risky as it could be easy to forget and not realise which environment you're actually connected to.

 

Am I misunderstanding the documentation? Is there any guidance/tips on how to make the active environment always based the folder/env you're working from? In other types of web project, ENV files are just used by default without having to explicitly force it.

http://iamkeir.com
Reply 1 (1)

iamkeir
Shopify Partner
205 0 41

Open issue on Github regarding this: https://github.com/Shopify/cli/issues/2220

http://iamkeir.com