All Projects → dzikoysk → cdn

dzikoysk / cdn

Licence: Apache-2.0 License
Simple and fast property-based configuration library for JVM apps, similar to JSON5 standard, also with JSON & YAML-like targets 🧾

Programming Languages

java
68154 projects - #9 most used programming language
kotlin
9241 projects

Projects that are alternatives of or similar to cdn

awesome-json-next
A Collection of What's Next for Awesome JSON (JavaScript Object Notation) for Structured (Meta) Data in Text - JSON5, HJSON, HanSON, TJSON, SON, CSON, USON, JSONX/JSON11 & Many More
Stars: ✭ 50 (+51.52%)
Mutual labels:  hjson, json5
config-parser
A slim, fully managed C# library for reading/writing .ini, .conf, .cfg etc configuration files.
Stars: ✭ 67 (+103.03%)
Mutual labels:  configs
dots
My dotfiles
Stars: ✭ 67 (+103.03%)
Mutual labels:  configs
cassandra-nginx-cdn
Some config files and POC code to use Apache Cassandra as distributed storage for HLS chunks accross multiple datacenters and scripts for converting/transcoding UDP MPEG-TS to HLS and vice versa. The idea is take from Globo.com’s Live Video Platform for FIFA World Cup ’14.
Stars: ✭ 24 (-27.27%)
Mutual labels:  cdn
smart rtmpd
RTMP server, smart, compact, high performance(c, c++), high concurrency, easy to maintain, easy to deploy, (supports multiple operating systems Windows and Linux, ARM, FreeBSD)
Stars: ✭ 159 (+381.82%)
Mutual labels:  cdn
cm
Configuration management for all VOC systems
Stars: ✭ 17 (-48.48%)
Mutual labels:  cdn
CloudflareSpeedTest
🌩「自选优选 IP」测试 Cloudflare CDN 延迟和速度,获取最快 IP (IPv4 / IPv6)!另外也支持其他 CDN / 网站 IP ~
Stars: ✭ 5,092 (+15330.3%)
Mutual labels:  cdn
AutoChange12306CDN
一个自动切换12306 CDN的代理,只需设置浏览器的代理为此软件监听端口,每次查询请求都会更换CDN,达到快速刷票的目的。
Stars: ✭ 35 (+6.06%)
Mutual labels:  cdn
dots
🌀 my linux configuration
Stars: ✭ 66 (+100%)
Mutual labels:  configs
configmanager
Forget about configparser, YAML, or JSON parsers. Focus on configuration. NOT RECOMMENDED FOR USE (2019-01-26)
Stars: ✭ 15 (-54.55%)
Mutual labels:  configs
p2p-cdn-sdk-android
Free p2p cdn android github sdk to reduce video streaming costs of live and on demand video using webrtc by upto 90% and improve scalability by 6x - 🚀 Vadootv 🚀
Stars: ✭ 39 (+18.18%)
Mutual labels:  cdn
aerobatic-cli
CLI for interacting with Aerobatic static hosting platform
Stars: ✭ 13 (-60.61%)
Mutual labels:  cdn
cdn-up-and-running
CDN Up and Running - an introduction about how modern CDNs works
Stars: ✭ 131 (+296.97%)
Mutual labels:  cdn
indexed-cache
A tiny Javsacript library for sideloading static assets on pages and caching them in the browser's IndexedDB for longer-term storage.
Stars: ✭ 56 (+69.7%)
Mutual labels:  cdn
nocdn
Self-hosted alternative to CDNs.
Stars: ✭ 37 (+12.12%)
Mutual labels:  cdn
auto-cloudinary
Super simple Cloudinary auto-upload implementation for WordPress.
Stars: ✭ 34 (+3.03%)
Mutual labels:  cdn
Bijou.js
Bijou.js: Useful JavaScript snippets in one simple library
Stars: ✭ 30 (-9.09%)
Mutual labels:  cdn
underwater
~2kb - ES6 Collection of helper functions. Lodash like
Stars: ✭ 18 (-45.45%)
Mutual labels:  cdn
zarch
The Ultimate Script For Arch Linux
Stars: ✭ 49 (+48.48%)
Mutual labels:  configs
uploadcare-rails
Rails wrapper for Uploadcare
Stars: ✭ 48 (+45.45%)
Mutual labels:  cdn

CDN CDN CI Reposilite codecov CodeFactor

Simple and fast configuration library for JVM based apps, powered by CDN (Configuration Data Notation) format, based on enhanced JSON for Humans standard. Handles CDN, JSON and YAML-like configurations with built-in support for comments and automatic scheme updates.

Overview

  • Supports Java, Kotlin (dedicated extension) and Groovy
  • Automatically updates configuration structure and migrates user's values
  • Lightweight ~ 70kB
  • Respects properties order and comment entries
  • Bidirectional parse and render of CDN sources
  • Serialization and deserialization of Java entities
  • Indentation based configuration (YAML-like)
  • Compatibility with JSON format
  • Null-safe querying API

Table of Contents

Installation

Gradle

repositories {
    maven { url 'https://repo.panda-lang.org/releases' }
}

dependencies {
    // Default
    implementation 'net.dzikoysk:cdn:1.13.17'
    // Kotlin wrapper
    implementation 'net.dzikoysk:cdn-kt:1.13.17'
}

Manual

You can find all available versions in the repository:

Using the library

TLDR

A brief summary of how to use the library.

public final class AwesomeConfig {

    @Description("# Comment")
    public String property = "default value";

}

Handling:

Cdn cdn = CdnFactory.createStandard();
File configurationFile = new File("./config.cdn");

// Load configuration
AwesomeConfig configuration = cdn.load(configurationFile, AwesomeConfig.class)
// Modify configuration
configuration.property = "modified value";
// Save configuration
cdn.render(configuration, configurationFile);

To explore all features, take a look at other chapters.

Load configuration

By default, CDN is meant to use class-based configuration. It means that configurations are accessed through the standard Java instance. Let's say we'd like to maintain this configuration:

hostname: 'localhost'

At first, every configuration is loaded into the Configuration object.

Configuration configuration = cdn.load("hostname: localhost")
String hostname = configuration.getString("hostname", "default value, if the requested one was not found")

To avoid such a cringe configuration handling, we can just map this configuration into the Java object. Let's declare the scheme:

public final class Config {
    
    public String hostname = "default value";
    
}

The last thing to do is to provide this class during the load process:

Config config = cdn.load("hostname: localhost", Config.class)
config.hostname // returns 'localhost'

Update properties

Configurations can be updated in both variants. As you can see in the previous chapter, we've declared hostname field as non-final. It means we can just update it's value and CDN will update this field during next render.

config.hostname = "new value";

For configuration without scheme, we can use setString method:

configuration.setString("hostname", "new value");

Save configuration

CDN can render configuration elements and entities using render methods. The output depends on the installed format.

Supported formats

Various formats ae supported through the Feature api. Available format features:

  • DefaultFeature (CDN)
  • JsonFeature
  • YamlFeature

Output comparison:

Standard JSON feature YAML-like feature
# entry comment
key: value
# section description
section {
  list [
    1st element
    2nd element
  ]
}
   
# entry comment
"key": "value",
# section description
"section": {
 "list": [
  "1st element",
  "2nd element"
 ]
}
   
# entry comment
key: value 
# section description
section:
  list:
    - 1st element
    - 2nd element
   

Who's using

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].