{"id":19509870,"url":"https://github.com/steamclock/steamclenv","last_synced_at":"2026-03-12T20:11:55.648Z","repository":{"id":204989483,"uuid":"614031461","full_name":"steamclock/SteamclEnv","owner":"steamclock","description":"A library for handling environment variables in Swift","archived":false,"fork":false,"pushed_at":"2024-12-02T20:45:46.000Z","size":65,"stargazers_count":0,"open_issues_count":5,"forks_count":0,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-11-20T04:03:10.619Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/steamclock.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-14T18:49:22.000Z","updated_at":"2024-12-02T20:45:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"884646dc-5ff1-4883-8aba-1e77bd5f1f18","html_url":"https://github.com/steamclock/SteamclEnv","commit_stats":null,"previous_names":["steamclock/steamclenv"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/steamclock/SteamclEnv","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steamclock%2FSteamclEnv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steamclock%2FSteamclEnv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steamclock%2FSteamclEnv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steamclock%2FSteamclEnv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/steamclock","download_url":"https://codeload.github.com/steamclock/SteamclEnv/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steamclock%2FSteamclEnv/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30441857,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-12T14:34:45.044Z","status":"ssl_error","status_checked_at":"2026-03-12T14:09:33.793Z","response_time":114,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T23:13:38.386Z","updated_at":"2026-03-12T20:11:55.640Z","avatar_url":"https://github.com/steamclock.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SteamclEnv\nA library to make handling environment variables in Swift a little bit Nicer.\n\n- [Usage](#usage)\n    - [Using `generate`](#using-generate)\n- [Interfacing with CI](#interfacing-with-ci)\n    - [Bitrise](#bitrise)\n    - [Xcode Cloud](#xcode-cloud)\n- [Installation](#installation)\n- [License](#license)\n\n# Usage\n\nSteamclEnv is a small CLI tool that contains two main commands: `generate` to generate your `Environment.swift` file, usually via a build script when developing locally, and `ci-helper` to reproduce the same behaviour with various CI tools. See [interfacing with CI](#interfacing-with-ci) below for more info on the latter.\n\n## Using `generate`\n\nAfter [installation](#installation), you can call `steamclenv generate` and have things ✨just work✨, but we provide some additional options if desired:\n\n| Command | Short | Description |\n| ------ | ------ | ---------- |\n| --debug | n/a | Toggle debug mode, which prints more information out to the console while running the script. |\n| --dev | -d | Use `.env.dev` rather than `.env`. This is superseded by --path if provided. |\n| --output-path | -o | Path your output file should write to, relative to your current directory. You can include a full or partial path. File name will default to Environment.swift if not provided. |\n| --path | -p | Path to your environment file, relative to the current directory. This overrides --dev. |\n| --plain-text | n/a | Turns off variable obfuscation. See [obfuscation](#obfuscation) for more information. |\n\n## Obfuscation\n\nInspired by the folks at [NSHipster](https://nshipster.com/secrets/), by default the values generated in your `Environment.swift` file are obfuscated. \n\nYou can pass in the `--plain-text` command to turn this off if desired. While this isn't a perfect solution by any means, it adds a small but worthwhile layer of obscurity that's worth including.\n\n# Interfacing with CI\n\nSteamclEnv includes a `ci-helper` command that generates shell scripts to produce your Environment.swift in CI. We current support run scripts for Bitrise and Xcode Cloud.\n\nThe following additional commands are available:\n\n| Command | Short | Description |\n| ------- | ----- | ----------- |\n| --example-path | -e | Full path to your example environment file, including file name, if you don't want to use the default. Relative to the current directory. |\n| --environment-keys | n/a | A list of your environment variable keys, separated by commas. You can use this rather than passing in a .env.example file if desired. | \n| --output-path | -o | Full path you'd like to output your finished environment file to, including filename, relative to the current directory. |\n\n## Bitrise\n\n1. In the Bitrise workflow editor, add your environment variables to the project, being sure to match the variable keys that are in your `.env` file.\n\n2. Use the `ci-helper bitrise` command to generate your script, providing your environment keys using a `.env.example` file or passing them in with the `environmentKeys` option. Make sure you provide an `--output-path` if using a non-standard location for `Environment.swift` as well.\n\n3. Add a new Script step to your workflow between your `Git Clone Repository` and `xcodebuild` steps, and copy the contents of the outputted `bitrise.sh` into that script.\n\n4. Trigger a new build and your `Environment.swift` file should be generated as the script runs.\n\n## Xcode Cloud\n\n1. Add your environment variables to your workflow in App Store Connect, being sure to match the variable keys that are in your `.env` file.\n\n2. Use the `ci-helper xcode` command to generate your script, providing your environment keys using a `.env.example` file or passing them in with the `environmentKeys` option. Make sure you provide an `--output-path` if using a non-standard location for `Environment.swift` as well.\n\n3. Copy the resulting `ci_pre_xcodebuild.sh` file into your `ci_scripts` folder. Note this folder should be at the root directory of your project to ensure it is run. You may need to use `chmod +x ./ci_pre_xcodebuild.sh` to ensure your script runs. See the [Apple documentation](https://developer.apple.com/documentation/xcode/writing-custom-build-scripts) for more info.\n\n4. Commit and push your changes with the new run script. Start a new build and your `Environment.swift` file should be generated as the script runs.\n\n# Installation\n\nSteamclEnv uses a build script to generate your `Environment.swift` file at build time, so set up is a little more involved than your usual package...\n\n### 1. Install SteamclEnv through the [Swift Package Manager](https://swift.org/package-manager/).\n    a. In Xcode, click *File*, then *Add Package Dependencies*\n    b. In the search bar, enter: `git@github.com:steamclock/steamclenv.git`\n    c. Select the `SteamclEnv` package and add it to your project\n    \n### 2. Create your `.env` file(s)\n\nBy default, your `.env` file should live in the same directory as your `.xcodeproject` file. Your environment variables should use an `=` sign, with no leading or trailing spaces, to separate keys and values and include one pair per line. Like so:\n\n```\nKEY=VALUE\nANOTHER_KEY=ANOTHER_VALUE\n```\n\nYou can see an example of each of these files in the [example project](https://github.com/steamclock/SteamclEnv/tree/main/SteamclEnv-Example).\n\nIt's sometimes helpful to commit a `.env.example` file that contains all the keys found in your environment file, but not the values, to help folks who pull down your project know which keys they need to track down. Doing so will make setting up your CI scripts easier as well.\n\nDon't forget to add your `.env` files (and `Environment.swift`) to your `.gitignore` as well.\n    \n### 3. Setup and run code generation\n\nSteamclEnv generates your `Environment.swift` file by parsing your `.env` file, so any time you make changes to your environment, you'll want to re-run SteamclEnv.\n\nThe easiest way to do this is with a build script, which requires you to install the SteamclEnv CLI. To make it easier to set up the CLI, you can run the bundled InstallCLI SPM plugin. This plugin builds the CLI and links the executable to your project.\n\nTo install it, right-click on your project in the Xcode file explorer, then select the `SteamclEnv \u003e Install CLI` command near the bottom. You'll need to grant the plugin 'write' access to your project directory for it to work.\n\n### 4. Create your run script\n\nIn Xcode, select your target, then Build Phases, and add a new Run Script. Drag this Run Script above the 'Compile Sources' step, and enter your run script. It should look like:\n\n```\nif which ./steamclenv; then \n    ./steamclenv generate\nelse\n    echo \"Warning: SteamclEnv was expected to run but is not installed.\"\nfi\n```\n\nSee [Usage](#usage) for a list of commands you can use to customize the generation.\n\n### 6. Toggle User Script Sandboxing\n\nYou'll need to change a Build Setting to allow Steamclenv to read/write from inside your project directory. \n\nSet \"User Script Sandboxing\" (ENABLE_USER_SCRIPT_SANDBOXING) to `NO` for your target to allow SteamclEnv to properly read your environment files.\n\n### 7. Add your generated files to your target\n\nBuild your project and make sure your run script ran by checking to see if a new `Environment.swift` file was created. \nBy default your new file should be output to the root project directory. Add that file to your target, and you should be good to go! \n\n### 6. Make nice apps! 🚀\n\n# License\n\nSteamclEnv is available under the MIT license. See [LICENSE.md](https://github.com/steamclock/steamclenv/blob/main/LICENSE.md) for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteamclock%2Fsteamclenv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsteamclock%2Fsteamclenv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteamclock%2Fsteamclenv/lists"}