Cloudflare Provider
===================
.. versionadded:: 0.0.3
`Cloudflare Pages `_ can be used to host static files that's generated by Hugo. Unlike Netlify and Vercel, Cloudflare pages does not
come with a configuration file. That means to set the Hugo version an API is used to update or add ``HUGO_VERSION`` environment variable. uHugo can help you with that.
To tell uHugo to use Cloudflare the following configuration needs to be done in either ``config.yaml`` or ``config.toml``.
.. tabs::
.. code-tab:: toml config.toml
[uhugo]
name = "cloudflare" # required
project = "some-name" # optional
email_address = "env:email_address" # optional
account_id = "env:account_id" # required
api_key = "env:api_key" # required
.. code-tab:: yaml config.yaml
uhugo:
name: "cloudflare" # required
project: "some-name" # optional
email_address: "env:email_address" # optional
account_id: "env:account_id" # required
api_key: "env:api_key" # required
uHugo supports two ways to authenticate with Cloudflare:
1. You can use Global API key. For this you need to set ``email_address``, ``account_id`` and ``api_key`` in the configuration file. ``email_address`` is your authentication email ID, ``account_id`` can be retrieved from `Workers Dashboard `_ and
``api_key`` can be retrieved from `API Token `_ and copy the "Global API Key".
2. Or you can use the new API keys. For this you need to set ``account_id`` and ``api_key`` in the configuration file. ``account_id`` can be retrieved from `Workers Dashboard `_ and
``api_key`` can be retrieved from `API Token `_ and use ``Edit Cloudflare Workers`` template.
.. note:: ``api_key`` must be a "Global API Key" or else the API cannot be authenticated.
.. warning:: For security reasons, it is highly recommended that you not save API keys in the configuration file but rather set it as an environment variable.
For example, whenever a configuration property is set to ``env:api_key``, uHugo will search for ``api_key=some-key`` as the environment variable.