(self)
Interpolates the considered config.

        In order to perform this variable substitution LXDock will use environment variables plus
        some other pre-defined variables. The later will be injected in the context used to perform
        this interpolation.
Interpolates the considered config.
Interpolates the considered config .
def interpolate(self):
        """ Interpolates the considered config.

        In order to perform this variable substitution LXDock will use environment variables plus
        some other pre-defined variables. The later will be injected in the context used to perform
        this interpolation.
        """
        # Builds a dictionary of variables that will be used to perform variable substitution in the
        # config values.
        mapping = {}
        mapping.update(os.environ)

        # Fetches variables that could be defined in a .env file and inserts them in the mapping.
        env_filepath = os.path.join(self.homedir, '.env')
        if os.path.exists(env_filepath):
            mapping.update(dotenv_values(env_filepath))

        # Inserts LXDock special variables into the final mapping.
        mapping.update({
            # The absolute path toward the home directory of the LXDock project is injected into
            # the mapping used to perform variable substitution in the initial config.
            # This can be useful to reference paths that are relative to the project's root
            # directory in LXDock file options such as inline commands.
            'LXDOCK_YML_DIR': self.homedir,
        })

        try:
            self._dict = interpolate_variables(self._dict, mapping)
        except KeyError as e:
            raise ConfigFileInterpolationError(
                'Variable substitution failed when parsing the LXDock file. The failing variable '
                'name is: ${}'.format(e.args[0]))
def interpolate ( self ) : # Builds a dictionary of variables that will be used to perform variable substitution in the # config values. mapping = { } mapping . update ( os . environ ) # Fetches variables that could be defined in a .env file and inserts them in the mapping. env_filepath = os . path . join ( self . homedir , '.env' ) if os . path . exists ( env_filepath ) : mapping . update ( dotenv_values ( env_filepath ) ) # Inserts LXDock special variables into the final mapping. mapping . update ( { # The absolute path toward the home directory of the LXDock project is injected into # the mapping used to perform variable substitution in the initial config. # This can be useful to reference paths that are relative to the project's root # directory in LXDock file options such as inline commands. 'LXDOCK_YML_DIR' : self . homedir , } ) try : self . _dict = interpolate_variables ( self . _dict , mapping ) except KeyError as e : raise ConfigFileInterpolationError ( 'Variable substitution failed when parsing the LXDock file. The failing variable ' 'name is: ${}' . format ( e . args [ 0 ] ) )