To get the environment variables in snapping

Manik Taneja manik at
Tue Mar 14 02:16:39 UTC 2017


i wonder if this would be better confined as classic?


On Mon, Mar 13, 2017 at 1:29 AM, Jin Hsieh <jin.hsieh at> wrote:

> Hello guys,
> We are making a workable mail solution snap,
> the selected back-end services are Postfix(SMTP) and Dovecot(POP3/IMAP).
> For those services as you known they have some dependencies with classic
> paths,
> for example the /etc/postfix/ and /etc/dovecot/dovecot.conf so we
> made some changes on the upstream code,
> to get the environment variables such as SNAP, SNAP_DATA/SNAP_COMMON by
> getenv(),
> then replace the classic one into $SNAP_DATA/etc/postfix/* to make it works
> properly.
> Also, for a bigger snap like this,
> the component(one of the parts) will execute external command to trigger
> another one,
> in such the case Postfix forks its child process: pipe to call dovecot-lda
> (which is a sub-process of Dovecot),
> to complete the mail retrieving function, now I would say *it is lucky to
> have a useful configuration parameter* "export_environment" in Postfix,
> so that we can make sure the commands could be executed correctly in our
> snap world with specific $SNAP exported.
> But you could recognize the modification we made *is hard to upstream guys
> to accept/merge the changes into their trunk*,
> so many getenv("SNAP") in the code or in where the code flow uses
> clean_env() we also need to cache the SNAP-related variables,
> I am wondering if we have a better way to do this, for example an interface
> or environment-sharing could make the life easier?
>     1. then have the chances to make the upstream code up without
> getenv("SNAP") to make their code snap-adaptive
>     2. then have a much regular way to export environment when one
> component calls another one externally without "export_environment" support
> Any feedback would be welcomed,
> many thanks.
> BR.
> Jin
> --
> Snapcraft mailing list
> Snapcraft at
> Modify settings or unsubscribe at:
> mailman/listinfo/snapcraft

More information about the Snapcraft mailing list