apache-formula
apache-formula copied to clipboard
How can I add environment variables using apache formula
Hello every one, I want to add some variables environment to the client vhost using apache formula (apache2.4): This an example: (there is a {{name}} : {{value}} ) ENV_UPLOAD_PATH: '/home/user/htdocs/' ENV_VIDEO_URL: 'https://example.com/player/' ENV_VIDEO_PATH: '/home/user/htdocs/player/' ENV_VIDEO_SSL_URL: 'https://example.com/player/' ENV_VIDEO_SECURE_URL: 'https://example.com/player/'
I want that it will be like this in the virtualhost:
SetEnv ENV_UPLOAD_PATH /home/user/htdocs/ SetEnv ENV_VIDEO_URL https://example.com/player/ SetEnv ENV_VIDEO_PATH /home/user/htdocs/player/ SetEnv ENV_VIDEO_SSL_URL https://example.com/player/ SetEnv ENV_VIDEO_SECURE_URL https://example.com/player/
In the pillar.example in apache_formula I can't precise which option or parametre i can use to achieve my goal. https://github.com/saltstack-formulas/apache-formula/blob/72dc03a4e774c0e26e37e6df5e11ca498c996300/pillar.example Can any one help me to add those variables. Thank you for your Help
In apache-2.4.config.jinja there is some relevant code for handling global section in pillar.example.
{%- for directive, dvalue in salt['pillar.get']('apache:global', {}).items() %}
{{ directive }} {{ dvalue }}
{%- endfor %}
Could you share what you would like pillar.example to look like for your Vhost UC? This looks like a missing feature so agreeing wanted pillars would be first step.
Currently, for virtual hosts, dropping a cfg-file into {{ apache.confidr }} might be a solution but thats not what you are asking here.
# Supplemental configuration
#
# Load config files in the "/etc/httpd/conf.d" directory, if any.
IncludeOptional {{ apache.confdir }}/*.conf
{% if apache.vhostdir != apache.confdir %}
IncludeOptional {{ apache.vhostdir }}/*.conf
{% endif %}
I was looking for adding custom directives as well and I did not readily understand how to do it initially by looking at the sample pillar. Use the Formula_Append option to add custom apache directives. This would go inside your site configuration.
Formula_Append: |
SetEnv ENV_UPLOAD_PATH /home/user/htdocs/
SetEnv ENV_VIDEO_URL https://example.com/player/
SetEnv ENV_VIDEO_PATH /home/user/htdocs/player/
SetEnv ENV_VIDEO_SSL_URL https://example.com/player/
SetEnv ENV_VIDEO_SECURE_URL https://example.com/player/