Skip to content

Connect the Drupal editor ​

The Drupal article connector reads content. The editor integration adds the buttons that let an author request a preview, review a specific version and confirm publication from Drupal. Installing the connector alone does not add those buttons.

Start with the author walkthrough if you want to see what editors will do.

What runs where ​

PartResponsibility
Drupal module foliwakeProvides author forms, checks Drupal permissions, stores outgoing requests and reports the current state of an article and its media.
foliwake integration serveAccepts authenticated requests from Drupal, performs background work and serves the protected, version-specific review pages.
Existing Foliwake siteSupplies the Drupal source configuration, frontend releases, persistent state and object storage.
Existing delivery service and cacheContinue serving published content. A visitor does not call the Drupal module.

The integration service is an additional long-running process. It is not the admin dashboard, and it is not the ordinary preview origin. A connection binds one Drupal installation to one configured Foliwake site and one Drupal source within that site.

Prerequisites ​

Before adding the module, make the Drupal connector work through the existing Foliwake sync, preview and publish flow. The site needs a prepared frontend and an existing live release. Keep its state directory persistent and back it up with its configuration.

This implementation targets Drupal 11 and PHP 8.3 or later. The reported isolated demo used Drupal 11.4.10 and PHP 8.5; that is a tested combination, not a claim that every supported combination has been tested. It expects the article mapping of Drupal's demo profile: bundle article, body field_body, lead image field_media_image, and the core node, media, file and path-alias modules. Other content models need explicit adaptation.

1. Configure a connection in Foliwake ​

Create a separate foliwake.connections.json. For a site named docs-site with source ID drupal, a connection can look like this:

json
{
  "version": 1,
  "server": {
    "host": "127.0.0.1",
    "port": 8095,
    "reviewBaseUrl": "https://review.example.org"
  },
  "connections": [{
    "id": "docs-site",
    "site": "docs-site",
    "sourceId": "drupal",
    "languages": ["en", "es"],
    "serviceTokenEnv": "FOLIWAKE_SERVICE_TOKEN",
    "freshness": {
      "baseUrl": "https://drupal.example.org",
      "tokenEnv": "FOLIWAKE_FRESHNESS_TOKEN"
    },
    "review": {
      "basicUserEnv": "FOLIWAKE_REVIEW_USER",
      "basicPasswordEnv": "FOLIWAKE_REVIEW_PASSWORD"
    },
    "drupalOrigin": "https://drupal.example.org"
  }]
}

Use the actual IDs from your site configuration. List only the languages that connection should handle. drupalOrigin is the browser-facing Drupal address used by Edit in Drupal and Publish to live. freshness.baseUrl is the address Foliwake uses to read the module's freshness endpoints; it may differ when the backend uses a private network.

For a private freshness endpoint, explicitly allow its host with freshness.allowPrivateHosts. The existing Drupal connector has its own network policy; configuring one does not automatically configure the other. In containers, 127.0.0.1 means that container unless you deliberately use host networking.

2. Supply credentials to the right processes ​

The configuration contains environment-variable names, never secret values.

VariableWho needs itPurpose
FOLIWAKE_SERVICE_TOKENDrupal and the integration processAuthenticates Drupal's commands to its Foliwake connection.
FOLIWAKE_FRESHNESS_TOKENDrupal and the integration processAuthenticates Foliwake's reads of current Drupal content and media evidence.
FOLIWAKE_REVIEW_USER and FOLIWAKE_REVIEW_PASSWORDIntegration process; reviewer knows the loginProtect the version-specific review pages and their assets.

Generate two different random service/freshness tokens, each at least 32 characters. Load them through your deployment's secret mechanism. Do not put them in Git, a Drupal configuration export, a URL or browser JavaScript. These are separate from dashboard sign-in links and the ordinary preview token.

The module reads FOLIWAKE_ORIGIN and FOLIWAKE_CONNECTION too. For this example their non-secret values are https://review.example.org and docs-site.

3. Install and configure the Drupal module ​

Copy integrations/drupal/foliwake/ from the Foliwake checkout into Drupal's web/modules/custom/foliwake/. Add this to the site's settings.php:

php
$settings['foliwake_freshness_token'] = getenv('FOLIWAKE_FRESHNESS_TOKEN') ?: NULL;
$settings['foliwake'] = [
  'origin' => getenv('FOLIWAKE_ORIGIN') ?: NULL,
  'connection' => getenv('FOLIWAKE_CONNECTION') ?: NULL,
  'service_token' => getenv('FOLIWAKE_SERVICE_TOKEN') ?: NULL,
  'allow_dev_origin' => FALSE,
];

origin is the integration service's HTTPS origin, without a path. For an isolated local test only, allow_dev_origin: TRUE permits HTTP/private development origins. Do not copy that exception into an exposed production setup without evaluating the network boundary.

Enable the module from the Drupal project:

sh
drush en foliwake

Grant roles the permissions they need:

  • view foliwake preview — see the article's Foliwake tab and review links.
  • update foliwake preview — request updates for articles they can edit.
  • publish foliwake website — confirm and publish reviewed articles they can edit.
  • administer foliwake — inspect pairing/configuration and local command records.

Update and publish also require Drupal update access to the particular article translation. A review-page password alone does not grant publication permission.

4. Start and expose the integration service ​

Run the following using the same site configuration, plugin registry, storage credentials and persistent site state as your Foliwake installation, plus the connection credentials above:

sh
foliwake integration serve \
  --config /path/to/foliwake.config.json \
  --connections /path/to/foliwake.connections.json

With the Docker package (foliwake server), there is no separate process. Put the file in the data folder as /data/foliwake.connections.json and restart the container (foliwake docker restart <name>): the server starts the integration service with it and answers it on the review host, review.<FOLIWAKE_DOMAIN> on the server's one port (set FOLIWAKE_REVIEW_HOST for another name). server.host and server.port of the file are not used there; review links use server.reviewBaseUrl when the file sets it, else the review host (for example https://review.example.com). Set the connection variables in the instance's .env (above the block managed by foliwake docker) and run foliwake docker update. The file is read when the server starts: after changing it, or after creating a site it names, restart the container. A file the integration refuses stops the start with its message. The start log names the connections and the review address. From the container, 127.0.0.1 is the container itself: give freshness.baseUrl an address the container reaches (another service on its Compose network, or the host's address) and allow a private one with freshness.allowPrivateHosts.

Run it under your normal service manager or container restart policy. Route https://review.example.org to its loopback listener on port 8095 using a TLS reverse proxy. The integration service handles two different forms of authentication:

  • /integration/v1/connections/… receives Drupal's Bearer-authenticated API requests and signed author assertions for mutations.
  • /review/… uses the configured review Basic Auth login and serves the pinned page and code assets. Route the whole service origin, including media requests, to the service.

Preserve the incoming Authorization header. Do not put a second blanket Basic Auth challenge in front of the Bearer API: Drupal's service token must reach the integration service. Review responses and integration API responses must bypass caching. reviewBaseUrl must match the externally reachable base address used in review links.

Drush/cron and web PHP must receive the module's environment variables. Schedule Drupal cron: it reconciles requests whose outcomes were uncertain. HTTP calls from Drupal are bounded, and long-running sync/publish work happens in Foliwake's worker. This avoids making one PHP request wait while Foliwake calls back into Drupal.

5. Verify the author flow before enabling it for a team ​

Open /admin/config/services/foliwake in Drupal. Check the setting-presence indicators and pairing with the integration service. Then test with an article you are allowed to change:

  1. Save and update preview, wait for readiness and open the review link.
  2. Check that the page has the frontend styling, its images load, and the toolbar returns to the correct Drupal installation.
  3. Confirm only that article in Drupal and wait for publication/cache status. Check the live page separately.
  4. Save another change after preparing a preview. The earlier review must show newer saved changes and must not publish the unseen edit.
  5. Verify that an editor without publication permission cannot publish.
  6. Review and explicitly select a related list when testing an article-title change. The list must not be included silently.

Use an isolated site for failure and rollback exercises. The implementation's reported demo covered 22 scenarios, including repeated confirmation, changing content/media, interrupted publication and failed cache refresh. That evidence does not replace testing your proxy, access rules, Drupal field mapping and storage deployment.

Operational limits ​

Update preview still syncs the entire configured Drupal source. Hash-based reuse and scoped acquisition are separate proposed work. The freshness endpoint's hashes currently protect correctness; their presence does not imply images are already being reused.

Review confirmation records expire after 30 minutes by default (receiptTtlSeconds). This is configurable and provisional. It is not a promise that the review URL disappears at that time: viewing a stored version and authorizing publication are different operations.

Keep both the Foliwake state and Drupal database persistent: they record review targets, commands and retries. If the result of a submission is uncertain, use its existing status/retry flow instead of creating another request. For committed publications awaiting cache refresh, use the normal cache recovery procedure with the same site configuration. Do not run recovery concurrently with an active publication worker; coordinate recovery with the operator responsible for that site.

Merging the implementation into main does not install the Drupal module, start this service, configure TLS or grant roles. Those are separate deployment steps.