On Tue, Feb 24, 2015 at 2:48 AM, Brice Figureau <
brice-pup...@daysofwonder.com> wrote:

> On Mon, 2015-02-23 at 06:57 -0800, Chris Price wrote:
> > On Sun, Feb 22, 2015 at 9:18 PM, Eric Sorenson
> > <eric.soren...@puppetlabs.com> wrote:
>
> How about this:
>
> rules {
>   "/path/to/first/resource" {
>     type = path
>     allow_ip = [ "192.168.10.0/24", "127.*" ]
>     allow = "*.abc.edu"
>   }
>
>   "^/path/to/(.*)/" {
>     type = regex
>     deny = "badhost.domain.com"
>     allow = [ "$1.domain.com", "goodhost.domain.com" ]
>   }
> }
>
> Since in HOCON objects are merged together when including another
> "rules" object its properties would add. The only downside is that the
> Config library (the HOCON java support) doesn't seem to support globbing
> on include.
>
> What I'm not sure is if hocon respects order of object keys (which might
> matters to some for rules ordering).
>

I'm pretty sure it doesn't make any guarantees about the order of object
keys, unfortunately.


> But it's a much more nicer syntax than using an array:
>
> rules = [
>   {
>     endpoint = "/path/to/resource"
>     type = path
>     allow_ip = [ "192.168.10.0/24", "127.*" ]
>     allow = "*.abc.edu"
>   },
>   ...
> ]
>
> which is much jsonesque,but might be more correct if order matters,
> IMHO.
>

Yeah, I agree, it's a little more clunky that way, but probably worth it
since it makes it 100% clear that the order matters.  Also, I think that
it'll be easier to programatically manipulate (via puppet modules, etc.)
with the array syntax.

FWIW we've been using colons over '=' in the config files we ship so far,
but that doesn't really matter since it'll support either.

I'll defer to Eric and others in terms of what the keys should be inside of
the maps, since I'm not particularly a power user on that subject :)

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-dev/CAMx1QfLiY15ZmYcm-L6kSH94nc6jt0hnriibq5ht8NPabAxUMg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to