Problem/Motivation

The instance access token is currently stored in the state API. This means that the instance key isn't being exported into configuration.

We can improve this by allowing the instance key to be stored in the settings.php file. This would allow deployments to happen without needing to manually add in the instance key.

Steps to reproduce

n/a

Proposed resolution

Add something like the following to the getAccessToken() method in the MastodonApiInstance service class.

    return $this->state->get('mastodon_api.' . $this->id() . '.mastodon_access_token') ?? $this->settings->get('mastodon_api.' . $this->id() . '.mastodon_access_token', '');

Also, the 'state' and 'settings' services can be injected into this class. There is no need to use an embedded \Drupal::state() callback.
Scratch that, this is a config entity class.

Remaining tasks

Add a test for this. The settings service can be mocked quite easily.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

philipnorton42 created an issue. See original summary.

philipnorton42’s picture

Issue summary: View changes
philipnorton42’s picture

Issue summary: View changes

philipnorton42’s picture

Need to document this feature now that it is in place.

Once that's done I'll release a new version.

philipnorton42’s picture

Documentation updated.

I'll update the module copy as well.

philipnorton42’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

philipnorton42’s picture

Status: Fixed » Closed (fixed)

Added to release 1.0.0-beta1.