{"id":46062878,"url":"https://github.com/dimensionalpocket/dps-config","last_synced_at":"2026-04-10T20:04:23.560Z","repository":{"id":324116003,"uuid":"1095969909","full_name":"dimensionalpocket/dps-config","owner":"dimensionalpocket","description":"Config struct for the DPS ecosystem.","archived":false,"fork":false,"pushed_at":"2026-02-22T03:01:27.000Z","size":58,"stargazers_count":0,"open_issues_count":5,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-22T10:31:15.277Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","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/dimensionalpocket.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2025-11-13T19:01:50.000Z","updated_at":"2026-02-06T06:50:00.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/dimensionalpocket/dps-config","commit_stats":null,"previous_names":["dimensionalpocket/dps-config-rs","dimensionalpocket/dps-config"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/dimensionalpocket/dps-config","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimensionalpocket%2Fdps-config","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimensionalpocket%2Fdps-config/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimensionalpocket%2Fdps-config/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimensionalpocket%2Fdps-config/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dimensionalpocket","download_url":"https://codeload.github.com/dimensionalpocket/dps-config/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimensionalpocket%2Fdps-config/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29968580,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T10:55:55.490Z","status":"ssl_error","status_checked_at":"2026-03-01T10:55:55.175Z","response_time":124,"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":"2026-03-01T11:37:30.078Z","updated_at":"2026-04-10T20:04:23.546Z","avatar_url":"https://github.com/dimensionalpocket.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @dimensionalpocket/dps-config\n\n[![Rust Tests](https://github.com/dimensionalpocket/dps-config/actions/workflows/test.yml/badge.svg)](https://github.com/dimensionalpocket/dps-config/actions/workflows/test.yml) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)\n\nConfiguration management for the [DPS ecosystem](https://github.com/dimensionalpocket/dps-readme).\n\n## Overview\n\nThis repo provides the `DpsConfig` struct, a lightweight configuration container used by Rust components in the DPS ecosystem.\nIt focuses on optional values, sensible defaults, environment variable loading, and computed getters.\n\nKey principles:\n\n- No validation in the struct; consuming crates perform validation.\n- Most getters provide hardcoded defaults suitable for development.\n- Environment variables are used to populate properties automatically.\n- Computed getters derive combined values (URLs, domains) from base properties.\n\n## Installation\n\n### Rust\n\nAdd it to `Cargo.toml`:\n\n```toml\n[dependencies]\ndps-config = { git = \"https://github.com/dimensionalpocket/dps-config\" }\n```\n\nOr add via cargo:\n\n```bash\ncargo add --git https://github.com/dimensionalpocket/dps-config dps-config\n```\n\n### Bun\n\n```bash\nbun add @dimensionalpocket/dps-config\n```\n\n## Quick Start\n\n### Rust\n\n```rust\nuse dps_config::DpsConfig;\n\nfn main() {\n    let mut config = DpsConfig::new();\n\n    // defaults\n    let domain = config.get_domain();\n    let api_path = config.get_api_path();\n\n    // overrides\n    config.set_domain(\"example.com\");\n    config.set_api_path(\"v1\");\n    config.set_development_mode(true);\n\n    let auth_api_url = config.get_auth_api_url();\n    println!(\"Auth API URL: {}\", auth_api_url);\n}\n```\n\n### Bun / TypeScript\n\nNote: The TypeScript constructor requires an environment object as its first argument, unlike the Rust version.\n\n```typescript\nimport { DpsConfig } from \"@dimensionalpocket/dps-config\";\n\n// On Bun / Node.js\nconst config = new DpsConfig(process.env);\n\n// defaults\nconst domain = config.getDomain();\nconst apiPath = config.getApiPath();\n\n// overrides\nconfig.setDomain(\"example.com\");\nconfig.setApiPath(\"v1\");\nconfig.setDevelopmentMode(true);\n\nconst authApiUrl = config.getAuthApiUrl();\nconsole.log(`Auth API URL: ${authApiUrl}`);\n\n// Vite support (loads environment variables with VITE_ prefix)\nconst viteConfig = new DpsConfig(import.meta.env, \"VITE_\");\n```\n\n## Configuration Properties\n\nThe following properties are provided. Properties load from environment variables when present.  \nEach property has a getter (`get_\u003cproperty_name\u003e()`) and a setter (`set_\u003cproperty_name\u003e(value)`).\n\n### Global\n\n| Property | Environment Variable | Default | Description |\n|----------|----------------------|---------|-------------|\n| `project_name` | `DPS_PROJECT_NAME` | `My Project` | Name of the project |\n| `domain` | `DPS_DOMAIN` | `dps.localhost` | Main domain of the website |\n| `api_path` | `DPS_API_PATH` | `api` | Path (without leading slash) for API endpoints |\n| `development_mode` | `DPS_DEVELOPMENT_MODE` | `false` | Enables development-only features |\n\n### DpsAuthApi\n\n| Property | Environment Variable | Default | Description |\n|----------|----------------------|---------|-------------|\n| `auth_api_subdomain` | `DPS_AUTH_API_SUBDOMAIN` | `auth` | Sub-subdomain for DpsAuthApi |\n| `auth_api_port` | `DPS_AUTH_API_PORT` | none | Port for DpsAuthApi (omitted from URL if unset) |\n| `auth_api_protocol` | `DPS_AUTH_API_PROTOCOL` | `https` | Protocol for DpsAuthApi |\n| `auth_api_insecure_cookie` | `DPS_AUTH_API_INSECURE_COOKIE` | `false` | Allow insecure cookies (HTTP) |\n| `auth_api_sqlite_main_file_path` | `DPS_AUTH_API_SQLITE_MAIN_FILE_PATH` | `data/main-development.db` | SQLite main database file path |\n| `auth_api_sqlite_main_pool_size` | `DPS_AUTH_API_SQLITE_MAIN_POOL_SIZE` | `1` | SQLite main database connection pool size |\n| `auth_api_sqlite_collection_file_path` | `DPS_AUTH_API_SQLITE_COLLECTION_FILE_PATH` | `data/collection-development.db` | SQLite collection database file path |\n| `auth_api_sqlite_collection_pool_size` | `DPS_AUTH_API_SQLITE_COLLECTION_POOL_SIZE` | `1` | SQLite collection database connection pool size |\n| `auth_api_sqlite_session_file_path` | `DPS_AUTH_API_SQLITE_SESSION_FILE_PATH` | `data/session-development.db` | SQLite session database file path |\n| `auth_api_sqlite_session_pool_size` | `DPS_AUTH_API_SQLITE_SESSION_POOL_SIZE` | `1` | SQLite session database connection pool size |\n| `auth_api_session_secret` | `DPS_AUTH_API_SESSION_SECRET` | none | 32-byte session secret for encryption |\n| `auth_api_session_ttl_seconds` | `DPS_AUTH_API_SESSION_TTL_SECONDS` | `1209600` (14 days) | Session TTL in seconds |\n\n## Computed Getters\n\nComputed getters derive values from base properties and have no setters or environment variables.\n\n- `get_auth_api_url()` — returns `{protocol}://{auth_api_subdomain}.{domain}/{api_path}` (with `:{port}` appended after domain when port is set)\n- `get_auth_api_session_secret_bytes()` — returns session secret as `Vec\u003cu8\u003e` for encryption libraries\n\n```rust\nlet mut c = DpsConfig::new();\nc.set_api_path(\"v1\");\nc.set_domain(\"dps.localhost\");\nassert_eq!(c.get_auth_api_url(), \"https://auth.dps.localhost/v1\");\n\n// Session secret as bytes (convenient for encryption libraries)\nc.set_auth_api_session_secret(Some(\"my-32-byte-secret-key-here!!!\"));\nif let Some(secret_bytes) = c.get_auth_api_session_secret_bytes() {\n    assert_eq!(secret_bytes.len(), 32);\n}\n```\n\n## Environment Variables\n\nProperties auto-load from environment variables when `DpsConfig::new()` is called.\nBoolean true is expressed as `\"Y\"` in environment variables.\n\nExample (development):\n\n```bash\nexport DPS_DOMAIN=\"dps.localhost\"\nexport DPS_API_PATH=\"api\"\nexport DPS_DEVELOPMENT_MODE=\"Y\"\nexport DPS_AUTH_API_PROTOCOL=\"http\"\nexport DPS_AUTH_API_PORT=\"3000\"\nexport DPS_AUTH_API_INSECURE_COOKIE=\"Y\"\nexport DPS_AUTH_API_SQLITE_MAIN_FILE_PATH=\"data/main-development.db\"\nexport DPS_AUTH_API_SQLITE_MAIN_POOL_SIZE=\"4\"\nexport DPS_AUTH_API_SQLITE_COLLECTION_FILE_PATH=\"data/collection-development.db\"\nexport DPS_AUTH_API_SQLITE_COLLECTION_POOL_SIZE=\"4\"\nexport DPS_AUTH_API_SQLITE_SESSION_FILE_PATH=\"data/session-development.db\"\nexport DPS_AUTH_API_SQLITE_SESSION_POOL_SIZE=\"4\"\nexport DPS_AUTH_API_SESSION_SECRET=\"dev-secret-key-32-bytes-long!\"\nexport DPS_AUTH_API_SESSION_TTL_SECONDS=\"1209600\"\n```\n\n## Usage Examples\n\n```rust\nuse dps_config::DpsConfig;\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n\n    #[test]\n    fn auth_url_builds() {\n        let mut c = DpsConfig::new();\n        c.set_domain(\"test.local\");\n        c.set_api_path(\"v1\");\n        c.set_auth_api_protocol(\"http\");\n        c.set_auth_api_port(Some(8080));\n        assert_eq!(c.get_auth_api_url(), \"http://auth.test.local:8080/v1\");\n    }\n\n    #[test]\n    fn auth_session_ttl_examples() {\n        let mut c = DpsConfig::new();\n\n        // default is 14 days in seconds\n        assert_eq!(c.get_auth_api_session_ttl_seconds(), 1209600);\n\n        c.set_auth_api_session_ttl_seconds(Some(3600));\n        assert_eq!(c.get_auth_api_session_ttl_seconds(), 3600);\n    }\n}\n```\n\n## Project Structure\n\n```\ndps-config/\n├── src/\n│   ├── index.ts  # Bun / TypeScript implementation\n│   └── lib.rs    # Rust implementation\n├── docs/         # documentation (LLM instructions, plans, drafts, etc.)\n├── Cargo.toml    # Rust package manifest\n├── package.json  # Bun package manifest\n└── README.md\n```\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdimensionalpocket%2Fdps-config","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdimensionalpocket%2Fdps-config","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdimensionalpocket%2Fdps-config/lists"}