{"ok": true, "next": null, "rows": [{"id": "writing_plugins:writing-plugins-configuration", "page": "writing_plugins", "ref": "writing-plugins-configuration", "title": "Writing plugins that accept configuration", "content": "When you are writing plugins, you can access plugin configuration like this using the  datasette plugin_config()  method. If you know you need plugin configuration for a specific table, you can access it like this: \n             plugin_config = datasette.plugin_config(\n    \"datasette-cluster-map\", database=\"sf-trees\", table=\"Street_Tree_List\"\n) \n             This will return the  {\"latitude_column\": \"lat\", \"longitude_column\": \"lng\"}  in the above example. \n             If there is no configuration for that plugin, the method will return  None . \n             If it cannot find the requested configuration at the table layer, it will fall back to the database layer and then the root layer. For example, a user may have set the plugin configuration option inside  datasette.yaml  like so: \n             [[[cog\nfrom metadata_doc import metadata_example\nmetadata_example(cog, {\n    \"databases\": {\n        \"sf-trees\": {\n            \"plugins\": {\n                \"datasette-cluster-map\": {\n                    \"latitude_column\": \"xlat\",\n                    \"longitude_column\": \"xlng\"\n                }\n            }\n        }\n    }\n}) \n             ]]] \n             [[[end]]] \n             In this case, the above code would return that configuration for ANY table within the  sf-trees  database. \n             The plugin configuration could also be set at the top level of  datasette.yaml : \n             [[[cog\nmetadata_example(cog, {\n    \"plugins\": {\n        \"datasette-cluster-map\": {\n            \"latitude_column\": \"xlat\",\n            \"longitude_column\": \"xlng\"\n        }\n    }\n}) \n             ]]] \n             [[[end]]] \n             Now that  datasette-cluster-map  plugin configuration will apply to every table in every database.", "breadcrumbs": "[\"Writing plugins\"]", "references": "[]"}], "truncated": false}