Advanced Codeblocks Multi Remote

Learn about the special features of the Advanced Codeblocks Multi Remote and get inspiration from specific examples.

The Advanced Codeblocks Multi Remote is used for inserting the config-block directly in Confluence but the template from any source.

Parameters

Title

Define the title of your codebox.

Expand first codeblock

Select the first codeblock of your codebox expanded.

URL to remote file

Enter the URL of your template.

HTTP username

This is optional. If you use Basic-Auth for your remote file enter your username.

HTTP password

This is optional. If you use Basic-Auth for your remote file enter your password.

Programming language

Select your language from over 150 programming languages or let your language detect automatically.

Theme

Select your theme from 4 themes.

User Interface

The user interface on your Confluence page will look like the example below. You can collapse and expand the codeblocks at any time to save space or to show the code when you need it.

Download Feature

The Download Feature provides you different options to directly download your configuration in the setting you need. You only have to click the respective Button. Don't forget to enable Show download links in your parameters to use this function.

  • Download codeblock: download the code of your template with replaced variables of the specific codeblock. The link is located on the right side of the header of each codeblock.

  • Download raw: download the raw code of your template with your defined variables accordingly without replacements. The link is located in the menu in the upper right corner of the outer box.

  • Download xml: download a xml list of all download links contained in your configuration. The link is located in the menu in the upper right corner of the outer box.

You can also use the Download Feature to download configs directly from Confluence in your automated provisioning scripts with e.g. curl or wget via HTTP REST API. This option is broadly explained in the basics.

Note for using the Download Feature

  • By changing the section name the download link changes.

  • By moving the macro to another page the download link changes.

Refresh Cache

Another menu item of the Advanced Codeblocks Multi Remote is the refresh cache button including a date. Everytime you make changes in your config-block or in your remote template, please refresh the cache to see the latest changes. The same applies for downloading. With the aid of the date you can see when the last refresh has happened.

Beware of caching

Even if you make changes in the macro body, the cache is not cleared. The cache will only renew once you click the refresh cache button.

Read-only mode (Data Center)

Since Advanced Codeblocks v2.5.0 and for Confluence Data Center versions higher or equal 6.10 the Read-only mode for Confluence Data Center is supported.

When the Read-only mode is activated, the Advanced Codeblocks Multi Remote will render with disabled download features and cache, since they would perform a write operation on the page properties. The user will see the message read-only mode is active on top of the menu.

If you for some reason call the refresh cache URL during enabled Read-only mode you will see this page.

Examples

Example 1: Simple substitution

Title

MyTestFile

Template URL

https://codeclou.io/test-advanced-codeblock-macro/v2.3/public/testfile.foo

HTTP username

-

HTTP password

-

programming language

-

theme

-

macro body

[foobar]
moo=wuff

Example 2: Python

Title

MyPythonExample

Template URL

https://codeclou.io/test-advanced-codeblock-macro/v2.3/public/backup.py

HTTP username

-

HTTP password

-

programming language

python

theme

-

macro body

[server1]
backup.from.dir = /var/lib
backup.to.dir = /media/usb1

[server2]
backup.from.dir = /opt
backup.to.dir = /media/usb2

Example 3: RAW File from Bitbucket Data Center

Title

Bitbucket

Template URL

https://localhost:7990/projects/TEST/repos/test/raw/test.txt

HTTP username

your Bitbucket username

HTTP password

personal access token or password

Troubleshooting

Use the Bitbucket RAW Url which returns a correct Content-Length header: /projects/{project}/repos/{repo}/raw/{filename}

If you enter a wrong password, the HTML login page will be displayed with HTTP 200 instead. The App then displays a a Content-Length header error - this is due to the behaviour of Bitbucket not the App itself.

If you are seeing Content-Length header errors then:

  1. Check if your Bitbucket account was locked and needs to solve a captcha.

  2. Check if your username and password is correct.

  3. Check if the RAW url is correct and the file exists.

Due to a Bug Bitbucket RAW URLs are only supported with App version 3.6.0+ with a with disabling the HTTP HEAD filesize check under global app settings.

macro body

[server1]
backup.from.dir = /var/lib
backup.to.dir = /media/usb1

[server2]
backup.from.dir = /opt
backup.to.dir = /media/usb2

Example 4: RAW File from GitHub

See blogpost