Disclaimer: this is an automatic aggregator which pulls feeds and comments from many blogs of contributors that have contributed to the Mono project. The contents of these blog entries do not necessarily reflect Xamarin's position.

January 28

Unity 2019.3 is now available

This release features a brand-new Editor interface, new Input System, faster in-Editor iteration time and lots of other improvements. The High Definition Render Pipeline and many 2D packages are now verified for 2019.3.  Regardless if you work in games, entertainment, automotive, architecture, or any other industry, the Unity 2019.3 TECH stream release has something for […]

The post Unity 2019.3 is now available appeared first on Unity Technologies Blog.

January 24

Unity XR platform updates

Amidst a period of innovation for XR, we want to ensure Unity remains the best development platform for creators and our ecosystem partners. We’re excited to announce our new XR plugin framework designed to empower the ecosystem and provide guidance on how this impacts development in 2019.3 and beyond. Unity XR plugin framework We have […]

The post Unity XR platform updates appeared first on Unity Technologies Blog.

Simple node.js service configuration

There’s a myriad of npm modules for providing configuration to a node.js application or service, but I’ve always found them simultaneously over-engineered and lacking basic validation of the configuration document.

I’ve settled on a pattern that works very well for my needs. It leverages the excellent Joi library for validation, and simple node built-ins for everything else.

This is the basic pattern, which I put in config.js at the root of the project:

const fs = require('fs');
const Joi = require('@hapi/joi');

const configSchema = Joi.object().required().keys({
    // Attribute schemas go here.
});

module.exports = Joi.attempt(
    JSON.parse(
        process.env.YOUR_APP_CONFIG ||
        fs.readFileSync(process.env.YOUR_APP_CONFIG_FILE || 'config.json', 'utf8')
    ),
    configSchema
);

That’s all there is to it. The module exports the validated config object.

The config document will be read from the first of these that is provided:

  1. The contents of the YOUR_APP_CONFIG environment variable.
  2. The contents of the file whose path is provided in the YOUR_APP_CONFIG_FILE environment variable.
  3. The contents of the file config.json in the working directory.

If the config cannot be read, parsed, or validated, an error will be thrown immediately, preventing the application from starting and providing helpful feedback on what part of the config document is in error.

As an additional advantage, default values specified in the schema will be filled in by Joi. The resulting benefit is that all defaults can be specified in a central location instead of sprinkled throughout the codebase as config.attribute || 'default value' tests.

A great example of this is the service’s listening port. Usually, I will specify this as something like:

const configSchema = Joi.object().required().keys({
    port: Joi.number().integer().min(1).max(65535).default(8080),
});

I never have to check whether config.port is set or has an acceptable value; the schema precisely describes the exact acceptable value domain as well a default value. I am guaranteed that config.port will be set and contain a good value.

Joi is incredibly flexible, and can even make parts of the schema conditional on parts of the input document, specify that some attributes are required only if other attributes are present, specify that exactly one of a set of mutually-exclusive attributes must be specified, and much more. Explore the documentation for more information.

Note that the exported object is mutable. If desired, you can use Object.freeze() to shallow-freeze the config object, or one of the many npm “deep freeze” modules to recursively freeze the entire object graph.

I’ve thought about publishing a module encapsulating this pattern, but after reducing it to its most basic form, there isn’t much left to put in a module. It’s already so short and simple that it’s easier to just copy the pattern.

January 23

Explore Revit models in VR with Unity Reflect

Unity Reflect makes it easy to bring Building Information Modeling (BIM) data into virtual reality (VR). Learn how you can use the Unity Reflect VR Viewer to conduct immersive design reviews with Autodesk Revit models. This blog post is about Unity Reflect, a product targeted at our architecture, engineering and construction audience. Read this blog […]

The post Explore Revit models in VR with Unity Reflect appeared first on Unity Technologies Blog.

January 22

Unity and Overtone at PAX East 2020

We’re showcasing Unity’s voice and text chat app, Overtone, at PAX East. Experience the power of this reliable, scalable, high-fidelity communication tool in Boston, MA, February 27 to March 1.  Connect with Overtone Overtone is a free downloadable voice and text chat app that enables gamers around the world to communicate in and out of […]

The post Unity and Overtone at PAX East 2020 appeared first on Unity Technologies Blog.

January 15

Community Component – 2019 in review and community creators to follow

Last year had great highlights like, the longest uninterrupted streak of #UnityTips on Twitter, regular weekly episodes of Best of Made with Unity projects and the rise of a new wave of Unity centric content creators on YouTube. With so much awesomeness to keep track of we’re dedicating the first Community Component of 2020 to […]

The post Community Component – 2019 in review and community creators to follow appeared first on Unity Technologies Blog.

Monologue

Monologue is a window into the world, work, and lives of the community members and developers that make up the Mono Project, which is a free cross-platform development environment used primarily on Linux.

If you would rather follow Monologue using a newsreader, we provide the following feed:

RSS 2.0 Feed

Monologue is powered by Mono and the Monologue software.

Bloggers