Environment Variables as storage roots

So I have put some environment variables as the storage location in file management. My method did require me to change files in C:\Program Files\Shotgun\Python\Lib\os.py. This obviously isn’t ideal. Is there a preferred way to put environment variables as storage? Or a preferred way to override that python file?

5 Likes

Are the env vars consistent across all users?

1 Like

They would be, yes.

1 Like

Unfortunately we don’t provide a way at the moment to use an environment variable in a storage root.

However if you were to modify our code to do it, I would have thought the changes should be made to tk-core and maybe the tk-framework-desktopserver and not to the os module.

I’ve logged a request on our roadmap page on your behalf.

2 Likes

Yup, we had to do this for a client to have per-user roots (perforce setup).
If the env var changes, you’ll have to use a “dummy” path for any paths stored as filesystem locations and then in the files Phil mentions, translate that path to/from the env var path when reading or writing to the database. It seems to work ok amazingly!.. but no doubt there are some failure cases that I’ve not discovered yet.
One other area you will have to update are all the workfiles, and loader2 hooks that might not expand the env vars in paths.

2 Likes

Any update on this?
This seems like a “simple” powerful request to be able to support. Requiring everyone on Windows/platform to use the same path is too much of an ask, and supporting an environment variable path would be a huge win.

Cheers.

2 Likes

I am also curious if we might have the ability to specify environment variables instead of hard coded paths.

It looks like environment variables for local storage are indeed a thing:
https://support.shotgunsoftware.com/hc/en-us/articles/115000067493-Integrations-Admin-Guide#Resolving%20local%20file%20links

Not sure why it seems hard to discover this fact

this assertion seems contradicted by the documentation linked, but maybe you mean specific to the toolkit schema or something.

1 Like

That’s for publishing only, doesn’t help with the storage roots used outside of publishing. I’ve tried.

2 Likes

good to know.

Hi, have there been any updates on this? I don’t see it on the roadmap anymore.

Thanks!
Nikhil

1 Like