NLog configuration in appsettings.json instead of nlog.config in .NET Core

Yes, this is possible but has a minimum version requirement. You must be using NLog.Extensions.Logging >= 1.5.0. Note that for ASP.NET Core applications this will be installed as a dependency if you install NLog.Web.AspNetCore >= 4.8.2. You can then create an NLog section in appsettings.json and load it with the following code: var config = … Read more

ConfigObj/ConfigParser vs. using YAML for Python settings file

It depends on what you want to store in your config files and how you use them If you do round tripping (yaml→code→yaml) and want comments preserved you cannot use PyYAML or ConfigParser. If you want to preserve the order of your keys (e.g. when you check in your config files), PyYAML doesn’t do that … Read more

Where do I put my XML beans in a Spring Boot application?

As long as you’re starting with a base @Configuration class to begin with, which it maybe sounds like you are with @SpringBootApplication, you can use the @ImportResource annotation to include an XML configuration file as well. @SpringBootApplication @ImportResource(“classpath:spring-sftp-config.xml”) public class SpringConfiguration { // }

Where should I place my settings and profiles for use with IPython/Jupyter 4.0?

First of all, check what’s in your ~/.jupyter/ folder. Some of the comments under the question mention you have a file named “MIGRATED” that contains only a timestamp. If you are in this state, run the command: jupyter notebook –generate-config which will create a new file ~/.jupyter/jupyter_notebook_config.py. If you already have this file, you don’t … Read more

Use of AuthConfig, BundleConfig, FilterConfig , RouteConfig and WebApiConfig in App_Start() folder in MVC

App_Start is just another folder that groups together ASP.NET MVC configuration, which in previous versions of ASP.NET MVC was done in Global.asax. ASP.NET MVC introduces more and more configuration elements, and this folder is ideal to place this configuration. For example, MVC 5’s new auth. configuration, such as for third-party login providers, are also placed … Read more

what is the best way to define constant variables python 3 [duplicate]

Constants (in a sense) in Python 3.8+ Python 3.8 introduces the typing.Final type qualifier, which is used to indicate that a variable or attribute should not be reassigned, redefined, or overridden. PEP 591 — Adding a final qualifier to typing from typing import Final # Annotate module variables # (with or without an explicit type, … Read more

How to version control config files pragmatically?

Instead of version-controlling the actual configuration file, you could put a template or defaults file in version control, and a script that would ask for DB information and credential to generate the real config file, which would be excluded from (i.e. ignored by) version control. On checkout, developers could run this script to get a … Read more

How can I store a binary file in a Kubernetes ConfigMap?

Binary ConfigMaps are now supported since Kubernetes version 1.10.0. From the readme notes: ConfigMap objects now support binary data via a new binaryData field. When using kubectl create configmap –from-file, files containing non-UTF8 data will be placed in this new field in order to preserve the non-UTF8 data. Note that kubectl’s –append-hash feature doesn’t take … Read more

Read all the contents in ini file into dictionary with Python

I suggest subclassing ConfigParser.ConfigParser (or SafeConfigParser, &c) to safely access the “protected” attributes (names starting with single underscore — “private” would be names starting with two underscores, not to be accessed even in subclasses…): import ConfigParser class MyParser(ConfigParser.ConfigParser): def as_dict(self): d = dict(self._sections) for k in d: d[k] = dict(self._defaults, **d[k]) d[k].pop(‘__name__’, None) return d … Read more