Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Alain Takoudjou
slapos
Commits
b9fca014
Commit
b9fca014
authored
Oct 05, 2012
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow to send env variable and custom config to apache recipe
parent
25c5fba2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
18 deletions
+41
-18
slapos/recipe/apachephp/__init__.py
slapos/recipe/apachephp/__init__.py
+41
-18
No files found.
slapos/recipe/apachephp/__init__.py
View file @
b9fca014
...
@@ -33,6 +33,27 @@ from slapos.recipe.librecipe import GenericBaseRecipe
...
@@ -33,6 +33,27 @@ from slapos.recipe.librecipe import GenericBaseRecipe
class
Recipe
(
GenericBaseRecipe
):
class
Recipe
(
GenericBaseRecipe
):
def
__init__
(
self
,
buildout
,
name
,
options
):
self
.
environ
=
{}
environment_section
=
options
.
get
(
'environment-section'
,
''
).
strip
()
if
environment_section
and
environment_section
in
buildout
:
# Use environment variables from the designated config section.
self
.
environ
.
update
(
buildout
[
environment_section
])
for
variable
in
options
.
get
(
'environment'
,
''
).
splitlines
():
if
variable
.
strip
():
try
:
key
,
value
=
variable
.
split
(
'='
,
1
)
self
.
environ
[
key
.
strip
()]
=
value
except
ValueError
:
raise
zc
.
buildout
.
UserError
(
'Invalid environment variable definition: %s'
,
variable
)
# Extrapolate the environment variables using values from the current
# environment.
for
key
in
self
.
environ
:
self
.
environ
[
key
]
=
self
.
environ
[
key
]
%
os
.
environ
return
GenericBaseRecipe
.
__init__
(
self
,
buildout
,
name
,
options
)
def
install
(
self
):
def
install
(
self
):
path_list
=
[]
path_list
=
[]
...
@@ -50,26 +71,28 @@ class Recipe(GenericBaseRecipe):
...
@@ -50,26 +71,28 @@ class Recipe(GenericBaseRecipe):
path_list
.
append
(
php_ini
)
path_list
.
append
(
php_ini
)
# Install apache
# Install apache
apache_config
=
dict
(
if
self
.
optionIsTrue
(
'default-conf'
,
True
):
pid_file
=
self
.
options
[
'pid-file'
],
apache_config
=
dict
(
lock_file
=
self
.
options
[
'lock-file'
],
pid_file
=
self
.
options
[
'pid-file'
],
ip
=
self
.
options
[
'ip'
],
lock_file
=
self
.
options
[
'lock-file'
],
port
=
self
.
options
[
'port'
],
ip
=
self
.
options
[
'ip'
],
error_log
=
self
.
options
[
'error-log'
],
port
=
self
.
options
[
'port'
],
access_log
=
self
.
options
[
'access-log'
],
error_log
=
self
.
options
[
'error-log'
],
document_root
=
self
.
options
[
'htdocs'
],
access_log
=
self
.
options
[
'access-log'
],
php_ini_dir
=
self
.
options
[
'php-ini-dir'
],
document_root
=
self
.
options
[
'htdocs'
],
)
php_ini_dir
=
self
.
options
[
'php-ini-dir'
],
httpd_conf
=
self
.
createFile
(
self
.
options
[
'httpd-conf'
],
)
self
.
substituteTemplate
(
self
.
getTemplateFilename
(
'apache.in'
),
httpd_conf
=
self
.
createFile
(
self
.
options
[
'httpd-conf'
],
apache_config
)
self
.
substituteTemplate
(
self
.
getTemplateFilename
(
'apache.in'
),
)
apache_config
)
path_list
.
append
(
httpd_conf
)
)
path_list
.
append
(
httpd_conf
)
wrapper
=
self
.
createPythonScript
(
self
.
options
[
'wrapper'
],
apache_args
=
[
self
.
options
[
'httpd-binary'
],
'-f'
,
self
.
options
[
'httpd-conf'
],
'slapos.recipe.librecipe.execute.execute'
,
[
self
.
options
[
'httpd-binary'
],
'-f'
,
self
.
options
[
'httpd-conf'
],
'-DFOREGROUND'
]
'-DFOREGROUND'
]
wrapper
=
self
.
createPythonScript
(
self
.
options
[
'wrapper'
],
'slapos.recipe.librecipe.execute.executee'
,
(
apache_args
,
self
.
environ
)
)
)
path_list
.
append
(
wrapper
)
path_list
.
append
(
wrapper
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment