> For the complete documentation index, see [llms.txt](https://onsharp.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://onsharp.gitbook.io/docs/basic-usage/configs-and-datastorage.md).

# Configs and DataStorage

## Configs using TOML

The built in config system of Onsharp uses the file format TOML which is a vartion of YAML and INI. The creation as well as the loading of the config will be managed by Onsharp itself. You just need to define a data class, and let Onsharp load this class.

```csharp
using Onsharp.IO;

namespace Tutorial
{
    [Config("myconfig")]
    public class MyConfig
    {
        public bool IsDebug { get; set; } = false;
    }
}
```

This data class is marked with the config attribute. You must define the name of the config file with the first parameter. The second parameter is optional and can define a sub directory.

Now you just need to register the config:

```csharp
using Onsharp.Plugins;

namespace Tutorial
{
    public class PluginMain : Plugin
    {
        public override void OnStart()
        {
             //Your start up logic here
             MyConfig config = Data.Config<MyConfig>(); 
        }
        
        public override void OnStop()
        {
            //Your stop and clean up logic here
        }  
    }
}
```

The config file gets automatically created in the data folder of the plugin and than loaded and returned.

## Data Storage

The data storage is not fully implemented currently. If you just want to write some kind of file to your data folder, you can access the directory info via `Data.Directory`&#x20;
