How to create an admin configuration page for Confluence macro?

Hello,

I creating a macro for Confluence and I need a page for administrators to set technicals parameters.
I would like to know how to create this configuration page and how from my macro I get the parameters’s values ?

I would like this config button on my app: How do that ?

BR

Hello @ThibautFAURE,

For the configure page, check out Confluence global settings and set the property useAsConfig to true.

.

Do try it out and let us know how it goes.

Ian

2 Likes

Ok thank but I need help.

I modified my manifest.xml file to add confluence:globalSettings:

modules:
  confluence:globalSettings:
    - key: myapp-global-settings
      resource: mainglobalsettings
      render: native
      resolver:
        function: globalsettings
      title: myapp Configuration
      useAsConfig: true
      function:
        - key: globalsettings
          handler: index.globalsettings
  macro:
    - key: myapp-hello-world-macro
      resource: main
      render: native
      resolver:
        function: resolver
      title: My App
...

and I do forge deploy I have these errors:

2:2     error    confluence:globalSettings references undefined function module with key '[object Object]'  valid-module-required

2:2     error    confluence:globalSettings references undefined function module with key 'globalsettings'  valid-module-require

I don’t understand errors

My goal is to create a global settings page for admin to write api key to xRay API then I will use api key value to call xRay API

Do you have a code example with globalsettings contain one textfield ?

I have exactly the same need but trying to use useAsConfig prop is not working.
This is my piece of manifest:

  confluence:globalPage:
    - key: configuration
      title: Configuration
      resource: configuration
      route: configuration
      render: native
      resolver:
        function: resolver
      useAsConfig: true
  function:
    - key: resolver
      handler: index.handler

And this is the error when i try to deploy:

Running forge lint...
Error: The deploy failed due to errors in the app code. Fix the errors before rerunning forge deploy, or run forge deploy --no-verify to skip the linter.

/Users/***/manifest.yml
18:2    error    confluence:globalPage should NOT have additional property 'resource'  valid-document-required

18:2    error    confluence:globalPage should NOT have additional property 'render'  valid-document-required

18:2    error    confluence:globalPage should NOT have additional property 'resolver'  valid-document-required

18:2    error    confluence:globalPage should NOT have additional property 'useAsConfig'  valid-document-required

18:2    error    confluence:globalPage required properties are 'title, route, function, key' or 'title, route, resource, key'  valid-document-required

X 5 issues (5 errors, 0 warnings)
  Issues found are not automatically fixable with forge lint.

Removing the only “useAsConfig” prop works. But I need to have the configuration button in the app section!

Make sure to utilise the confluence:globalSettings: module in the manifest!

You are absolutely right and I’m so sorry for having confused confluence:globalPage: with confluence:globalSettings:. Thanks!!!