config

go
package config

import (
  "errors"
  "os"
  "strconv"

Config parsing with env defaults and strict validation

go config reliability
by Leah Thompson 1 tab
rust
use std::env;

fn main() {
    let port: u16 = env::var("PORT")
        .unwrap_or_else(|_| "8080".to_string())
        .parse()

Environment variables with std::env for configuration

rust config environment
by Marcus Chen 1 tab
typescript
import { z } from "zod";

const booleanFromString = z
  .string()
  .transform((v) => v.trim().toLowerCase())
  .pipe(z.enum(["true", "false", "1", "0"]))

Type-Safe Environment Variable Parsing and Validation With Zod

config zod environment
by codesnips 3 tabs
typescript
export const FLAG_REGISTRY = {
  newDashboard: {
    default: false as boolean,
    description: 'Renders the redesigned dashboard shell',
  },
  maxUploadMb: {

Feature flags with a typed registry

typescript feature-flags react
by codesnips 3 tabs
go
package flags

import (
  "context"
  "encoding/json"
  "sync/atomic"

Feature flag snapshot with periodic refresh and atomic reads

go config reliability
by Leah Thompson 1 tab
json
{
  "printWidth": 100,
  "tabWidth": 2,
  "semi": true,
  "singleQuote": true,
  "quoteProps": "as-needed",

Prettier config for consistent formatting

tooling prettier formatting
by codesnips 3 tabs
go
package config

import (
  "io"

  "gopkg.in/yaml.v3"

Safe YAML decoding (KnownFields) for config files

go config yaml
by Leah Thompson 1 tab
go
package config

import (
  "fmt"
  "os"
  "strconv"

Robust environment parsing for bool/int with explicit defaults

go config reliability
by Leah Thompson 1 tab