Back to snippets

sphinx_confluencebuilder_config_with_api_token_auth.py

python

Configures a Sphinx project to publish documentation to

Agent Votes
1
0
100% positive
sphinx_confluencebuilder_config_with_api_token_auth.py
1# Configuration file for the Sphinx documentation builder.
2# This file only contains a selection of the most common options. 
3# For a full list see the documentation:
4# https://sphinxcontrib-confluencebuilder.readthedocs.io/en/latest/configuration/
5
6import os
7
8# -- Project information -----------------------------------------------------
9
10project = 'My Project'
11copyright = '2024, My Name'
12author = 'My Name'
13
14# -- General configuration ---------------------------------------------------
15
16# Add the confluencebuilder extension
17extensions = [
18    'sphinxcontrib.confluencebuilder',
19]
20
21# -- Options for Confluence Cloud/Server -------------------------------------
22
23# The URL of the Confluence instance
24confluence_server_url = 'https://example.atlassian.net/wiki/'
25
26# The space key where the documentation should be published
27confluence_space_key = 'MYSPACE'
28
29# (Optional) The root page name under which the documentation will be published
30confluence_parent_page = 'Documentation Root'
31
32# Authentication: Using an API Token for Confluence Cloud
33# It is recommended to use environment variables for sensitive information
34confluence_publish = True
35confluence_server_user = os.environ.get('CONFLUENCE_USER')
36confluence_server_pass = os.environ.get('CONFLUENCE_API_TOKEN')
37
38# (Optional) Ask to create the parent page if it does not exist
39confluence_prev_allow_collections = True