Code Explainers
Code explainers tagged #environment-variables
go
package config import ( "fmt"
A thread-safe config singleton in Go
singleton
concurrency
environment-variables
Intermediate
7 steps
python
import os from pathlib import Path BASE_DIR = Path(__file__).resolve().parent.parent.parent
How a Django settings module is wired
configuration
environment-variables
middleware
Intermediate
8 steps
ruby
module AppConfig module_function def fetch(key, default: nil, required: false)
Typed environment variable config in Ruby
environment-variables
type-coercion
configuration
Intermediate
7 steps
python
import os from datetime import timedelta
Class-based config in a Flask app factory
configuration
app-factory
inheritance
Intermediate
7 steps
php
<?php namespace App\Config;
Writing a .env file loader in PHP
parsing
environment-variables
configuration
Intermediate
9 steps
python
import os from dataclasses import dataclass from functools import lru_cache
Loading typed config from environment variables
configuration
environment-variables
type-coercion
Intermediate
6 steps
go
package config import ( "fmt"
Loading typed config from environment variables in Go
configuration
environment-variables
type-parsing
Beginner
8 steps
rust
use std::env; use std::time::Duration; #[derive(Debug, Clone)]
Loading typed config from environment variables in Rust
configuration
error-handling
generics
Intermediate
7 steps
typescript
import { Module, Injectable } from '@nestjs/common'; import { ConfigModule, ConfigService } from '@nestjs/config'; import * as Joi from 'joi';
Validated, typed config in NestJS
configuration
validation
dependency-injection
Intermediate
6 steps