Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F4793272
list-nginx-vhosts.tcl
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
list-nginx-vhosts.tcl
View Options
#!/usr/bin/env tclsh8.6
# -------------------------------------------------------------
# List nginx vhosts configuration files
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# Created: 2017-10-24
# License: BSD-2-Clause
# Source file: roles/webserver-core/tools/files/list-nginx-vhosts.tcl
# -------------------------------------------------------------
#
# <auto-generated>
# This file is managed by our rOPS SaltStack repository.
#
# Changes to this file may cause incorrect behavior
# and will be lost if the state is redeployed.
# </auto-generated>
# -------------------------------------------------------------
# List
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
proc
list_nginx_vhosts
{}
{
foreach
file
[
get_vhosts_files
]
{
puts
" include $file;"
}
}
proc
get_vhosts_files
{}
{
lsort
[
glob
[
get_vhosts_path
]]
}
proc
get_vhosts_path
{}
{
join
[
list
[
get_local_etc
]
nginx vhosts
*
.conf
]
[
file
separator
]
}
# -------------------------------------------------------------
# /etc or /usr/local/etc?
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
proc
get_local_etc
{}
{
if
{[
is_bsd_os
]}
{
return
"/usr/local/etc"
}
{
return
"/etc"
}
}
proc
is_bsd_os
{}
{
lcontains
[
exec
uname
]
{
FreeBSD
OpenBSD NetBSD DragonFly Darwin
}
}
proc
lcontains
{
needle
haystack
}
{
expr
[
lsearch
$haystack
$needle
]
>=
0
}
# -------------------------------------------------------------
# Procedural code
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
list_nginx_vhosts
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Feb 28, 21:45 (1 d, 14 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2437144
Default Alt Text
list-nginx-vhosts.tcl (1 KB)
Attached To
Mode
rOPS Nasqueron Operations
Attached
Detach File
Event Timeline
Log In to Comment