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

Expand environment variables in some configuration variable #113

Closed
wants to merge 2 commits into from
Closed

Expand environment variables in some configuration variable #113

wants to merge 2 commits into from

Conversation

Konubinix
Copy link

No description provided.

@konvpalto
Copy link
Member

At which use-case these modification are targeted? You need to expand some other variable that $HOME?

@Konubinix
Copy link
Author

Hi,
konvpalto notifications@github.com writes:

At which use-case these modification are targeted? You need to expand some other variable that $HOME?
For the time being, I have
--8<---------------cut here---------------start------------->8---
pythonfile = ${KONIX_PERSO_DIR}/offlineimap.py
--8<---------------cut here---------------end--------------->8---

and
--8<---------------cut here---------------start------------->8---
sslcacertfile = ${KONIX_CA_FILE}
--8<---------------cut here---------------end--------------->8---

In my offlineimap.conf file.

Location pointed by those environment variable depend on the machine I
am working on.

In order to only expand the HOME variable, I would have to move a lot of
files to have the same file hierarchy on all the computers.

Konubinix
GPG Key : 7439106A
Fingerprint: 5993 BE7A DA65 E2D9 06CE 5C36 75D2 3CED 7439 106A

@spaetz
Copy link
Member

spaetz commented Sep 24, 2014

That having said, I defer the decision to merge this to konvpalto who should be making the call.

@konvpalto
Copy link
Member

I'll merge this feature, but I am planning to have more generic mechanism to have filters (read, environment variable expansion and other stuff) to be done not in every function, but to make it driven by configuration hash inside the OI code. So it will take some time, though I don't expect that it will be more than a week.

@Konubinix
Copy link
Author

I can't wait to see it :-)

@Ram-Z
Copy link

Ram-Z commented Oct 24, 2014

I was about to start writing a patch for this. My use case is very similar:

pythonfile = $XDG_CONFIG_HOME/offlineimap/utils.py
metadata = $XDG_DATA_HOME/offlineimap

@Konubinix
Copy link
Author

Hi,
konvpalto notifications@github.com writes:

I'll merge this feature, but I am planning to have more generic mechanism to have filters (read, environment variable expansion and other stuff) to be done not in every function, but to make it driven by configuration hash inside the OI code. So it will take some time, though I don't expect that it will be more than a week.

Do you still plan to do it.

May be you can tell us exactly what should filters look like. I would be happy to write
the code.

Konubinix
GPG Key : 7439106A
Fingerprint: 5993 BE7A DA65 E2D9 06CE 5C36 75D2 3CED 7439 106A

It is a bit cleaner than making chains of calls like
{{{
value = os.path.expanduser(value)
value = os.path.abspath(value)
}}}
since we do see all transformations to be applied in a single
iterable and have no repeated code like in the above example.

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
@brandur
Copy link

brandur commented Nov 12, 2014

For the little it's worth, +1 for pulling this in for the interim until the more sophisticated filtering system can about.

Expand environment variables in the following configuration items:
- general.pythonfile;
- general.metadata;
- mbnames.filename;
- Repository.localfolders.
- Repository.sslcacertfile.

Make tilde and environment variable expansion in the following
configuration items:
- Repository.sslclientcert;
- Repository.sslclientkey.

GitHub pull request: #113
Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
@konvpalto
Copy link
Member

Sorry, the patch was living in my tree for a couple of weeks, but was drowned with $WORK. 8f3c22e and e51ed80 that were just been pushed to "next" should implement the needed functionality.

Please, test.

@Konubinix
Copy link
Author

konvpalto notifications@github.com writes:

Sorry, the patch was living in my tree for a couple of weeks, but was drowned with $WORK. 8f3c22e and e51ed80 that were just been pushed to "next" should implement the needed functionality.

Please, test.

It appears to work. The code is indeed much cleaner than what I
proposed. Thank you for taking this use case into account.

Konubinix
GPG Key : 7439106A
Fingerprint: 5993 BE7A DA65 E2D9 06CE 5C36 75D2 3CED 7439 106A

@konvpalto
Copy link
Member

Thanks a lot for your testing and proposed functionality!

@konvpalto konvpalto closed this Nov 12, 2014
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

5 participants