0.1.123 • Published 5 months ago

a3ensite v0.1.123

Weekly downloads
-
License
Apache License 2....
Repository
github
Last release
5 months ago

a3ensite

  • a3ensite make sites - Generate apache or nginx configuration file
  • a3ensite make hosts - Generate hosts entries to /etc/hosts or any other Hosts.FileLoc
  • a3ensite status - Print status Sites, Hosts

Reference

  • $[VARIABLE]$ = required variable - apply content & show line or throw an error if not.
  • $?[VARIABLE]$ = optional variable - apply content & show line if variable is set.
  • $![VARIABLE]$ = display variable - show line if variable is set.

config - a3ensite.json

sites and output location configuration in JSON

{
  "options": {
        "Hosts": {
            "EnabledLoc": "/etc/hosts"
            "HostNameKey": "ServerName",
            "HostIpKey": "ServerIp",
        }
  },
  "server": {
    "EnabledLoc": "/tmp",
    "OutputFile": "app.conf",
  },
  "defaults": {
    "Servername": "server0"
  },
  "sites": [
    {
      "ServerName": "server1",
      "ServerAlias": "alias1",
      "ServerIp": "127.0.0.1",
      "ServerOptional": "optional-value-1"
    },
    {
      "ServerName": "server2",
      "ServerAlias": "alias2",
      "ServerIp": "127.0.0.1",
      "ServerHidden": "hidden-value-2"
    },
    {
      "ServerName": "dev.local",
      "ServerAlias": "www.dev.local",
      "ServerIp": "127.0.0.1",
      "WebSocket": "ws://dev.local"
    }
  ]
}

template - -a3ensite.conf-

template for generating output

<VirtualHost *:80>
  ServerName $[ServerName]$
  ServerAlias $[ServerAlias]$
  ServerOptional $?[ServerOptional]$
  ProxyPreserveHost On $![ServerHidden]$

  RewriteEngine on                            $![WebSocket]$
  RewriteCond %{HTTP:Upgrade} websocket [NC]  $![WebSocket]$
  RewriteCond %{HTTP:Connection} upgrade [NC] $![WebSocket]$
  RewriteRule ^/?(.*) "$?[WebSocket]$/$1" [P,L]
<VirtualHost>

a3ensite enable | make


output - a3ensite.live.conf

Generated output

<VirtualHost *:80>
  ServerName server1
  ServerAlias alias1
  ServerOptional optional-value-1

<VirtualHost>

<VirtualHost *:80>
  ServerName server2
  ServerAlias alias2
  ProxyPreserveHost On

<VirtualHost>

<VirtualHost *:80>
  ServerName dev.local
  ServerAlias www.dev.local

  RewriteEngine on
  RewriteCond %{HTTP:Upgrade} websocket [NC]
  RewriteCond %{HTTP:Connection} upgrade [NC]
  RewriteRule ^/?(.*) "ws://dev.local/$1" [P,L]
<VirtualHost>
0.1.123

5 months ago

0.1.122

5 months ago

0.1.11

10 months ago

0.1.12

10 months ago

0.1.0

10 months ago

0.1.1

10 months ago

0.1.121

10 months ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago