Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modification Request #88

Open
sellerthorpe opened this issue Jun 1, 2016 · 1 comment
Open

Modification Request #88

sellerthorpe opened this issue Jun 1, 2016 · 1 comment

Comments

@sellerthorpe
Copy link

sellerthorpe commented Jun 1, 2016

Good morning!

I love the module, and it has worked very well for me with a couple slight modification for my environment. I wanted to contribute to the project by letting you know what I tweaked, and seeing if this falls in line with what you've done. Hopefully you would like to add these changes to a future release, as it could help others who have a similar need.

  1. I had to add data content support for both a canonical database and generic database in the server.pp file. While you do have support for the main.cf parameters, there is currently no way to populate the files themselves through an automated fashion, which is what I was after.
    -->
    $canonical_data = [],
    $generic_data = [],
    .....
    And hashed the default files at the end of server.pp.
    -->
    postfix::dbfile { 'canonical':
    content => template('postfix/canonical.erb'),
    }
    postfix::dbfile { 'generic':
    content => template('postfix/generic.erb'),
    }
  2. These templates are very simple. They started with the default "help text" version that comes with postfix. At the bottom, I simple set them up to append anything in hash form from the data variable.
    -->
    <% @generic_data.each do |line| -%>
    <%= line %>
    <% end -%>

-->
<% @canonical_data.sort.each do |line| -%>
<%= line %>
<% end -%>

So as you can see, it should fall in line with what is already created. This just allows central configuration of the map data, as opposed to manually creating them on each server. In my environment this is required as none of my servers are routeable through to our corporate mail, and DNS is not resolvable. We use maps to mask our sender to a proper address before it hits a relay.

I hope this helps others out!
Thank you for creating this.

@sellerthorpe
Copy link
Author

I have recently updated the templates I started to properly hash these variables. I am still a bit new to this, so while my original templates work, they were not written as proper hashes.

In server.pp
...
$canonical_data = {},
$generic_data = {},
...

And in the templates, I replaced the 3 lines from before with this:
-->
<%- generic_data.keys.sort_by { |sk| (sk.to_s.upcase) }.each do |k| -%>
<%- v = generic_data[k] -%>
<%- if v != :undef and v != '' -%>
<%= k %> <%= v %>
<%- end -%>
<%- end -%>

-->
<%- canonical_data.keys.sort_by { |sk| (sk.to_s.upcase) }.each do |k| -%>
<%- v = canonical_data[k] -%>
<%- if v != :undef and v != '' -%>
<%= k %> <%= v %>
<%- end -%>
<%- end -%>

Thank you again for this excellent module!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant