Giter Club home page Giter Club logo

helionconfig's People

Contributors

nikoutel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

helionconfig's Issues

Apache Directives without argument fail to parse

I have a few vhosts that use the SSLRequireSSL directive (https://httpd.apache.org/docs/2.4/mod/mod_ssl.html#sslrequiressl).

This directive is used as is. There are no parameters, no on/off. It's just a line inside a vhosts that states: SSLRequireSSL. Nothing else.

When you have a config file that has this it fails to parse. You get "Apache config format error!".
This is caused by the regex in ConfigType/Apache.php which expects a whitespace and then some more things which isn't there.

            if (preg_match('/^\s*(\w+)(?:\s+(.*?)|)\s*$/', $configLine, $configMatches)) { // Property
                if (!isset($configMatches[2])) {
                    throw new \UnexpectedValueException("Apache config format error!");
                }
                if ($level === 0) {
                    $block[$configMatches[1]] = $configMatches[2];
                    $result = $this->append($block, $result);
                    $block = array();
                } else {
                    $blockIn[$configMatches[1]] = $configMatches[2];
                    $blockChild = $this->append($blockIn, $blockChild);
                    $blockIn = array();
                }
            }

Config values overwrite when they have the same key

I'm using the library to parse apache configurations. I have a configuration like this:

<VirtualHost *:80>
	ServerAdmin [email protected]

	DocumentRoot /var/www/vhosts/default/web

	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined

	Include conf-available/php7.1-fpm.conf
	Include expires.conf
</VirtualHost>

When this is parsed the VirtualHost.Include config will have the expires.conf. During parsing it has overwritten the conf-available/php7.1-fpm.conf, since the are both stored in in the Include key. But since you can have multiple Include statements in apache configuration they should not overwrite.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.