mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-12 07:04:52 +09:00
Refactor away the config group concept and simplyfy the way config fields are defined. Fields are defined directly as properties of the static field fieldDefinitions on the class itself with a separate interface to declare the types of fields. This makes it possible to easily make accessing the config fields type checked in a way that lets plugins extend the interfaces with their own config options by adding additional fields to the interface via declation merging.
26 lines
736 B
TypeScript
26 lines
736 B
TypeScript
import * as lib from "@clusterio/lib";
|
|
|
|
declare module "@clusterio/lib" {
|
|
export interface InstanceConfigFields {
|
|
"statistics_exporter.command_timeout": number;
|
|
}
|
|
}
|
|
|
|
export default {
|
|
name: "statistics_exporter",
|
|
title: "Statistics Exporter",
|
|
description:
|
|
"Provides in-game item/fluid production, builds, kills, and pollution "+
|
|
"statistics to the cluster's Prometheus endpoint.",
|
|
instanceEntrypoint: "dist/plugin/instance",
|
|
instanceConfigFields: {
|
|
"statistics_exporter.command_timeout": {
|
|
title: "Command Timeout",
|
|
description:
|
|
"Timeout in seconds of the metrics command before returning results from the previous invocation.",
|
|
type: "number",
|
|
initialValue: 1,
|
|
},
|
|
},
|
|
} satisfies lib.PluginDeclaration;
|