{"id":15016085,"url":"https://github.com/theelectronwill/night-config","last_synced_at":"2025-04-08T02:38:09.019Z","repository":{"id":43882749,"uuid":"74285105","full_name":"TheElectronWill/night-config","owner":"TheElectronWill","description":"Powerful java configuration library for toml, yaml, hocon, json and in-memory configurations. Serialization/deserialization framework.","archived":false,"fork":false,"pushed_at":"2025-01-08T11:49:05.000Z","size":2056,"stargazers_count":246,"open_issues_count":23,"forks_count":30,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-01T01:37:33.387Z","etag":null,"topics":["configuration","configuration-management","deserialization","hocon","inotify","java-11","java-8","java-9","java-library","json","minecraft-forge","serde","serialization","toml","yaml"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TheElectronWill.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-11-20T15:52:01.000Z","updated_at":"2025-03-12T16:54:34.000Z","dependencies_parsed_at":"2024-04-26T10:30:45.292Z","dependency_job_id":"1696367e-6c51-4d89-b6d7-7fa4b9e90938","html_url":"https://github.com/TheElectronWill/night-config","commit_stats":{"total_commits":796,"total_committers":10,"mean_commits":79.6,"dds":0.02010050251256279,"last_synced_commit":"b43a1ec31dfd83f81c64ed6a82c60159db355c96"},"previous_names":[],"tags_count":48,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheElectronWill%2Fnight-config","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheElectronWill%2Fnight-config/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheElectronWill%2Fnight-config/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheElectronWill%2Fnight-config/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TheElectronWill","download_url":"https://codeload.github.com/TheElectronWill/night-config/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247766581,"owners_count":20992504,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["configuration","configuration-management","deserialization","hocon","inotify","java-11","java-8","java-9","java-library","json","minecraft-forge","serde","serialization","toml","yaml"],"created_at":"2024-09-24T19:48:23.260Z","updated_at":"2025-04-08T02:38:08.995Z","avatar_url":"https://github.com/TheElectronWill.png","language":"Java","readme":"![Night Config](logo.png)\n\n[![Maven Central](https://img.shields.io/maven-central/v/com.electronwill.night-config/core.svg)](https://central.sonatype.com/search?q=g%3Acom.electronwill.night-config)\n[![javadoc](https://javadoc.io/badge2/com.electronwill.night-config/core/javadoc.svg)](https://javadoc.io/doc/com.electronwill.night-config/core)\n[![CircleCI](https://dl.circleci.com/status-badge/img/gh/TheElectronWill/night-config/tree/master.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/TheElectronWill/night-config/tree/master)\n\n# Introduction\n\nNightConfig is a powerful yet easy-to-use java configuration library, written in Java 8.\n\nIt supports the following formats:\n- [JSON](https://www.json.org/)\n- [YAML v1.1](https://yaml.org/)\n- [TOML v1.0](https://github.com/toml-lang/toml)\n- [HOCON](https://github.com/typesafehub/config/blob/master/HOCON.md)\n\n# How to use\n\n- Please read the extensive [wiki](https://github.com/TheElectronWill/Night-Config/wiki).\n- You can also try the runnable [examples](examples/src/main/java) (see [below](#running-the-examples)).\n\n## Glimpse\n\n```java\n// Simple builder:\nFileConfig conf = FileConfig.of(\"the/file/config.toml\");\n\n// Advanced builder, default resource, autosave and much more (-\u003e cf the wiki)\nCommentedFileConfig config = CommentedFileConfig.builder(\"myConfig.toml\").defaultResource(\"defaultConfig.toml\").autosave().build();\nconfig.load(); // This actually reads the config\n\nString name = config.get(\"username\"); // Generic return type!\nList\u003cString\u003e names = config.get(\"users_list\"); // Generic return type!\nlong id = config.getLong(\"account.id\"); // Compound path: key \"id\" in subconfig \"account\"\nint points = config.getIntOrElse(\"account.score\", defaultScore); // Default value\n\nconfig.set(\"account.score\", points*2);\n\nString comment = config.getComment(\"user\");\n// NightConfig saves the config's comments (for TOML and HOCON)\n\n// config.save(); not needed here thanks to autosave()\nconfig.close(); // Close the FileConfig once you're done with it :)\n```\n\n## Running the examples\n\nEach file in `examples/src/main/java` has a main function and shows how to use NightConfig for many different use cases.\n\nTo run an example:\n1. Clone this repository.\n2. `cd` to it\n3. Run `./gradlew examples:run -PmainClass=${CLASS}` by replacing `${CLASS}` with the example of your choice.\n\nFor example, to run [FileConfigExample.java](examples/src/main/java/FileConfigExample.java):\n```sh\n./gradlew examples:run -PmainClass=FileConfigExample\n```\n\nThe file be compiled automatically, and the given main class will be executed.\n\n# Project building\n\nNightConfig is built with Gradle. The project is divided in several modules, the \"core\" module plus one module per supported configuration format. Please [read the wiki for more information](https://github.com/TheElectronWill/Night-Config/wiki/Modules-and-dependencies).\n\nThe releases are available on [Maven Central](https://search.maven.org/search?q=com.electronwill.night-config) and [JitPack](https://jitpack.io/#TheElectronWill/Night-Config).\n\n## Old Android modules\n\nOlder versions of Android (before Android Oreo) didn't provide the packages `java.util.function` and `java.nio.file`, which NightConfig heavily uses.\nTo attempt to mitigate these issues, I made a special version of each modules, suffixed with `_android`, that you could use instead of the regular modules.\n\nThese old `_android` modules are deprecated and will no longer receive updates.\nThe maintainance burden of these modules is not worth it, and these versions of Android have reached end of life since several years already.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheelectronwill%2Fnight-config","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftheelectronwill%2Fnight-config","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheelectronwill%2Fnight-config/lists"}