NOTIFICATION

Close

Notifications

Close
  • There are no notifications yet.

Account Settings

Close

Configuration Snippet by PostgreSQLCO.NF

How to include your configuration parameters on your website

You are a blog writer and in your posts you talk about Postgres, so you might end up mentioning sooner or later the postgresql.conf file and the configuration parameters of Postgres (GUCs), so you probably end up writing an HTML table or a simple bullet list of every parameter.

Guess what, we got you covered! Now you can add a cool snippet to your blog/website and link to your public configuration stored in hethe great Configuration Manager of PostgreSQL, you could give easy access to your readers to the documentation of each parameter and other features like copy the parameters in plain text that allows to paste directly into a postgresql.conf file.


See the following example:



To use the snippet, you only need to add two simple lines of code to your content, one with the HTML element which will hold the configuration and one to include the script that gathers all the information from the postgresqlco.nf configuration web console. The finale code will look like this:

<div class="postgresqlConfConfig" data-id="8c116727-c0af-4a28-b4c2-70966ee9a6fc"></div>
<script src="https://postgresqlco.nf/assets/snippet/postgresqlco.nf.config.min.js"></script>


There are two parameters that we must take care of from that code:

  • The postgresqlConfConfig class: which indicates the container that will hold the table with the parameters
  • The data-id attribute: which indicates the ID for the configuration you want to show

By using the above code on your website, you’ll end up with something like this:


Additional notes:

  • Even though we used a <div> element on the above example, you can totally use any other valid HTML element, like <p>.
  • As you will see on this page, you can add to your site as many configuration snippets as you need.





Additional Settings:

Darkmode Display

Showing your configuration on darkmode to match your website style is also possible. By including a simple data-attr to your snippet, you can instantly get a shiny dark themed table to display your postgresql.conf parameters.

To do so, when placing your HTML code, just include the data-theme=”dark” attribute and you will end up with a dark-themed table like the one below.




Metadata Display

There will be times when you might want to show not just the parameters included in your config, but also the name and Postgres version assigned to it. To do so, simply include the data-metadata=”true” attribute to your HTML code. Your configuration will now include a header with its name and Postgres version.




Hide Comments

Whenever you prefer not to include parameter comments in your website, you can safely disable them by adding the data-comments="false" attribute to your HTML code.




Error handling

If by any chance your configuration cannot be loaded, an error message like the one showed next will be displayed.

Close