customrealms / core

Core library for the CustomRealms runtime
https://customrealms.io/core
MIT License
35 stars 13 forks source link

Added support for global Config object in runtime #26

Closed nedaras closed 1 year ago

nedaras commented 2 years ago

Added support for Config object

To create config use

import { saveConfig } from '@customrealms/core'

const config= saveConfig() // Creates config.yml
const dataConfig= saveConfig('data') // Creates data.yml

// Put data
config.getConfig().set('message', 'this is a message')

// Get data
console.log(defualtConfig.getConfig().getString('message'))

// saves config
config.saveConfig()

// Reload config
config.reloadConfig()

Note

There are some function missing, but will be added

DoggersFor1 commented 2 years ago

This is great. Thanks!

AL1L commented 2 years ago

Haven't gotten a chance to look at it in-depth, but rather than overriding the hello world example, could you make a new one?

connerdouglass commented 2 years ago

I support adding the ability to read/write config yml files. I'm going to test this out and see how I like it – initially thinking we might want to do some minor cleanup of the Config API we create. I'll get back to you shortly!

andriemc commented 2 years ago

I really really would like this to be a feature, Sadly @AL1L hasn't reviewed the code yet.

andriemc commented 1 year ago

thank you.