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

Interpolate environment variables in config #476

Closed
djbe opened this issue Jan 8, 2018 · 8 comments
Closed

Interpolate environment variables in config #476

djbe opened this issue Jan 8, 2018 · 8 comments

Comments

@djbe
Copy link
Contributor

djbe commented Jan 8, 2018

For a current project, I'd like to point to the generated core data files, which are located in
.../Library/Developer/Xcode/DerivedData/MyProject-ejmewwsnckjibvevfqzrcrvqxxxv/Build/Intermediates.noindex/My Project.build/Development-iphoneos/My Project.build/DerivedSources
(or some variation thereof). For now, I can run sourcery via command line --sources $DERIVED_SOURCES_DIR parameters, but it'd be nice to do this using a yml config file.

Docker implemented variable substitution in this PR:
docker/compose#1765
It's implemented in Python, but might be a good basis to start from.

@krzysztofzablocki
Copy link
Owner

@djbe I can see how that could be useful for other people, do you want to take a try at implementing that?

@djbe
Copy link
Contributor Author

djbe commented Jan 16, 2018

Sure, I can try to whip something up next week.

I was thinking of keeping it simple, and only supporting stuff ${STUFF} stuff syntax (with curly braces). And only interpolate with environment variables, as I don't think there's anything else to interpolate with?

@krzysztofzablocki
Copy link
Owner

krzysztofzablocki commented Jan 17, 2018

works for me, thoughts @Antondomashnev @ilyapuchka @Liquidsoul @lucabartoletti ?

@Antondomashnev
Copy link
Collaborator

Sounds ok for me 👌

@mylemans
Copy link

Any update on this? I just ran into an issue that this would solve.

@Lutzifer
Copy link
Contributor

We (@djbe and me) recently added the possibility to automatically expand environment variables in yml files to swiftgen (SwiftGen/SwiftGen#564)
If this is still of interest for the sourcery project also, I would be willing to start the implementation of that.

For my projects, this would allow me to reuse the yml files across projects.

@krzysztofzablocki
Copy link
Owner

That would be awesome @Lutzifer

@CatalinMustata
Copy link
Contributor

Hey guys!

This works great if the env variables exist. However, I noticed that if they don't exist, they're not expanded to nothing (as it happens in a shell script) which breaks my use case. Is there a way around this I might have missed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants