Skip to content

Releases: swift-foundations/swift-environment

v0.1.2

Choose a tag to compare

@coenttb coenttb released this 01 Aug 08:59

Bug Fixes

  • Silence warning for missing environment files - only warn for actual file reading/parsing errors, not when environment files don't exist
  • This reduces noise for projects that don't need .env files while preserving helpful warnings for real issues

Technical Details

  • Added file existence check before attempting to read environment files
  • Cross-platform compatible using
  • Maintains backward compatibility with existing API

v0.1.1

Choose a tag to compare

@coenttb coenttb released this 01 Aug 08:11

🐛 Bug Fixes

  • Fixed quoted keys parsing in KEY=VALUE format: Environment variables with quoted keys (e.g., "ENV"=development) were being stored with quotes as part of the key name. Keys are now properly parsed to remove quotes, making them accessible via the expected unquoted key name (env["ENV"] instead of env["\"ENV\""]).

🧪 Testing

  • Added comprehensive test coverage for quoted keys handling in various formats
  • All existing tests continue to pass

Full Changelog: 0.1.0...0.1.1

0.0.1

Choose a tag to compare

@coenttb coenttb released this 29 Jul 12:29

Initial Release

A type-safe environment variable management system for Swift applications.

Features

  • Type-safe access: Convert environment variables to Int, Bool, URL, and String types
  • Required key validation: Ensure critical environment variables are present at runtime
  • Layered configuration: Load from process environment, local development files, and defaults
  • Dependencies integration: First-class support for Point-Free's Dependencies library
  • Comprehensive testing: Includes test helpers and mock values
  • Swift 6.0 compatibility with full platform support (iOS 13+, macOS 10.15+, tvOS 13+, watchOS 6+)
  • Complete documentation: Inline docs and DocC catalog with guides

Installation

Add to your Package.swift:

dependencies: [
    .package(url: "https://github.com/coenttb/swift-environment-variables", from: "0.0.1")
]

Quick Start

import EnvironmentVariables

// Basic usage
let env = try EnvironmentVariables.live(requiredKeys: ["API_KEY"])
let apiKey: String? = env["API_KEY"]
let port: Int? = env.int("PORT")

// With Dependencies
@Dependency(\.envVars) var env

See the documentation for complete usage examples and advanced patterns.