epifanio / adc-pycsw

Setup and deployment of PyCSW for the Arctic Data Centre (ADC) project
2 stars 0 forks source link

Change xslt environemt variable #3

Open epifanio opened 1 year ago

epifanio commented 1 year ago

We export the path used for the XSLT conversion from MMD to ISO:

export MMD_TO_ISO="path/to/mmd-ti-iso.xsl"

We should export just the PATH to an XSLT directory instead,

MMD_XSLT_DIR="/path/toMMD_XSLT_DIR"

and reuse such env in the code for the several output profiles

epifanio commented 1 year ago

Even better to read the MMD_XSL_DIR from the configuration file

This snippet will read and get values from the pycsw config file

from pycsw inport wsgi
import os
import configparser
from pycsw.core import util

pycsw_root = wsgi.get_pycsw_root_path(os.environ)
configuration_path = wsgi.get_configuration_path(os.environ, os.environ, pycsw_root)

config = configparser.ConfigParser(interpolation=util.EnvInterpolation())

with open(configuration_path, encoding='utf-8') as scp:
    config.read_file(scp)

#  config.get("server", "gzip_compresslevel")