mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
Customize apache conf for php
This commit is contained in:
parent
798cee75e1
commit
3ba251e049
2 changed files with 31 additions and 17 deletions
|
@ -178,6 +178,7 @@ def app_install(app, domain, path='/', label=None, public=False, protected=True)
|
|||
raise YunoHostError(1, _("App is already installed"))
|
||||
|
||||
unique_app_id = manifest['yunohost']['uid'] +'__'+ str(instance_number)
|
||||
app_final_path = apps_path +'/'+ unique_app_id
|
||||
script_var_dict = { 'APP_DIR': app_tmp_folder }
|
||||
|
||||
if 'dependencies' in manifest: _install_app_dependencies(manifest['dependencies'])
|
||||
|
@ -198,13 +199,40 @@ def app_install(app, domain, path='/', label=None, public=False, protected=True)
|
|||
if 'script_path' in manifest['yunohost']:
|
||||
_exec_app_script(step='install', path=app_tmp_folder +'/'+ manifest['yunohost']['script_path'], var_dict=script_var_dict, app_type=manifest['type'])
|
||||
|
||||
if is_webapp: domain_add([domain], web=True)
|
||||
if is_webapp:
|
||||
domain_add([domain], web=True)
|
||||
# Customize apache conf
|
||||
a2_conf_lines = [
|
||||
'Alias '+ path +' '+ app_final_path + manifest['launch_path']
|
||||
]
|
||||
|
||||
if manifest['yunohost']['webapp']['language'] == 'php':
|
||||
a2_conf_lines.extend([
|
||||
'<IfModule php5_module>',
|
||||
' AddType application/x-httpd-php .php',
|
||||
' <FilesMatch \.php$>',
|
||||
' SetHandler application/x-httpd-php',
|
||||
' </FilesMatch>',
|
||||
' AddType application/x-httpd-php-source .phps',
|
||||
' <IfModule dir_module>',
|
||||
' DirectoryIndex index.php index.html',
|
||||
' </IfModule>',
|
||||
'</IfModule>'
|
||||
])
|
||||
|
||||
a2_conf_file = a2_settings_path +'/'+ domain +'.d/'+ unique_app_id +'.app.conf'
|
||||
if os.path.exists(a2_conf_file): os.remove(a2_conf_file)
|
||||
|
||||
with open(a2_conf_file, 'a') as file:
|
||||
for line in a2_conf_lines:
|
||||
file.write(line + '\n')
|
||||
|
||||
os.system('service apache2 reload')
|
||||
|
||||
# Copy files to the right place
|
||||
try: os.listdir(apps_path)
|
||||
except OSError: os.makedirs(apps_path)
|
||||
|
||||
app_final_path = apps_path +'/'+ unique_app_id
|
||||
|
||||
# TMP: Remove old application
|
||||
if os.path.exists(app_final_path): shutil.rmtree(app_final_path)
|
||||
|
@ -215,20 +243,6 @@ def app_install(app, domain, path='/', label=None, public=False, protected=True)
|
|||
|
||||
app_setting_path = apps_setting_path +'/'+ unique_app_id
|
||||
|
||||
# Customize apache conf
|
||||
a2_conf_lines = [
|
||||
'Alias '+ path +' '+ app_final_path + manifest['launch_path']
|
||||
]
|
||||
|
||||
a2_conf_file = a2_settings_path +'/'+ domain +'.d/'+ unique_app_id +'.app.conf'
|
||||
if os.path.exists(a2_conf_file): os.remove(a2_conf_file)
|
||||
|
||||
with open(a2_conf_file, 'a') as file:
|
||||
for line in a2_conf_lines:
|
||||
file.write(line + '\n')
|
||||
|
||||
os.system('service apache2 reload')
|
||||
|
||||
|
||||
# TMP: Remove old settings
|
||||
if os.path.exists(app_setting_path): shutil.rmtree(app_setting_path)
|
||||
|
|
|
@ -212,7 +212,7 @@ def _lemon_config(domain):
|
|||
"$tmp->{'exportedHeaders'}->{'"+ domain +"'}->{'Auth-User'} = '$uid';",
|
||||
"$tmp->{'exportedHeaders'}->{'"+ domain +"'}->{'Remote-User'} = '$uid';",
|
||||
"$tmp->{'exportedHeaders'}->{'"+ domain +"'}->{'Desc'} = '$description';",
|
||||
"$tmp->{'exportedHeaders'}->{'"+ domain +"'}->{'Email'} = '$uid';",
|
||||
"$tmp->{'exportedHeaders'}->{'"+ domain +"'}->{'Email'} = '$mail';",
|
||||
"$tmp->{'exportedHeaders'}->{'"+ domain +"'}->{'Name'} = '$cn';",
|
||||
"$tmp->{'exportedHeaders'}->{'"+ domain +"'}->{'Authorization'} = '\"Basic \".encode_base64(\"$uid:$_password\")';",
|
||||
"$tmp->{'vhostOptions'}->{'"+ domain +"'}->{'vhostMaintenance'} = 0;",
|
||||
|
|
Loading…
Add table
Reference in a new issue