configuration posts

Umgebungsvariablen sind eine hervorragende Möglichkeit, Java-Anwendungen zu konfigurieren, ohne Einstellungen explizit in Code speichern zu müssen, z. B. für Datenbank- und Caching-Server oder für APIs von Drittanbietern.
Solche Einstellungen außerhalb des Codes vorzunehmen hat mehrere eindeutige Vorteile:
- Bei Änderungen der Einstellungen muss der Code nicht aktualisiert und erneut kompiliert werden.
- Die Offenlegung sensibler Anmeldeinformationen wie Benutzernamen und Passwörter sowie von Tokens wird verhindert.
- Derselbe Code kann in mehreren Umgebungen bereitgestellt werden.
In diesem kurzen Artikel werde ich Ihnen einige der Möglichkeiten zeigen, wie Sie mit Umgebungsvariablen in Java arbeiten können.
Zugriff auf Umgebungsvariablen in Java
Eine der häufigsten Methoden ist die Verwendung von System.getenv(), die ein optionales Argument des Typs String
akzeptiert. Je nachdem, ob ein Argument des Typs String
übergeben wird, werden unterschiedliche Werte von der Methode zurückgegeben. Genauer:
Wenn ein String
übergeben wird und er mit einem Schlüssel in der Map
der internen Umgebung übereinstimmt, wird dessen …

Environment variables are an excellent way to configure PHP applications because they keep the application’s settings outside of the code. By doing this, it's easier to prevent secure credentials from being exposed, maintain applications, and use applications across multiple environments.
In this tutorial, you're going to learn about some of the many ways in which environment variables can be set and retrieved in PHP applications. That way, your application can access all the information that it needs, such as API keys, uploaded files, query strings, and form data.
How to access environment variables in PHP
Use PHP's Superglobals
One of the most common ways that environment variables are accessed in PHP is through the use of Superglobals. These are built-in, predefined variables, available in all scopes. Initialised by the PHP runtime, they organise PHP's environment information in a (mostly) logical and efficient way, so that you only need to …

Environment variables are a great way to configure Java applications without having to explicitly store settings in code, such as for database and caching servers, or for third-party APIs.
Keeping such settings outside of the code has several distinct advantages:
- Avoids the need to update and recompile code when settings change
- Helps prevent exposing sensitive credentials, such as usernames and passwords, and deployment tokens
- You can deploy the same code in multiple environments
In this short article, I'm going to show you some of the ways of working with environment variables in Java.
How to access environment variables in Java
One of the most common ways is to use System.getenv(), which accepts an optional String
argument. Based on whether a String
argument is passed, a different value is returned from the method. Specifically:
If a String
is passed and it matches a key in the internal environment Map
, …

If there's one thing Vim users love more than saving a few seconds per day on keystrokes, it's trading tips and tricks with others about their own setup. As someone who's been using Vim for 7 years now as his primary text editor, I'm going to do my part by sharing some neat things from my .vimrc
that people have asked me about at conferences and hackathons in the past.
For each of these examples, I'll provide the code for you to copy/paste into your own .vimrc
and try to explain what's going on. Take what you think works for you and leave the rest!
Crosshair style cursor highlighting
One thing that people ask me about often is the crosshair style cursor that I use in my configuration. All you need to do to make your cursor look like this:
...is add these lines to your .vimrc
file (typically located …

Ever had that sinking moment of realisation when you push your secrets to GitHub? I have and I doubt I’m the only one.
There are many reasons why you wouldn’t want your sensitive configurations shared and I’m not just talking about on GitHub. Members of a development team may not use the same test databases or connection strings. Maybe the dev team only has access to the test keys for apps such as Twitter but the live keys are squirrelled away in Azure.
A common way to deal with sensitive data in an app is by using Environment Variables. With the arrival of .NET Core we now have a tidy way of managing configuration and sensitive data in the form of User Secrets, which can be managed by the Secrets Manager Tool (SMT) from the command line. User Secrets are stored outside of the project tree in a JSON …

Ever had that sinking moment of realisation when you push your secrets to GitHub? I have and I doubt I’m the only one.
There are many reasons why you wouldn’t want your sensitive configurations shared and I’m not just talking about on GitHub. Members of a development team may not use the same test databases or connection strings. Maybe the dev team only has access to the test keys for apps such as Twitter but the live keys are squirrelled away in Azure.
A common way to deal with sensitive data in an app is by using Environment Variables. With the arrival of .NET Core we now have a tidy way of managing configuration and sensitive data in the form of User Secrets, which can be managed by the Secrets Manager Tool (SMT) from the command line. User Secrets are stored outside of the project tree in a JSON …