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.
Issue fork mastodon_api-3586997
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
Comment #2
philipnorton42 commentedComment #3
philipnorton42 commentedComment #5
philipnorton42 commentedNeed to document this feature now that it is in place.
Once that's done I'll release a new version.
Comment #8
philipnorton42 commentedDocumentation updated.
I'll update the module copy as well.
Comment #10
philipnorton42 commentedComment #12
philipnorton42 commentedAdded to release 1.0.0-beta1.