{"id":15563927,"url":"https://github.com/mrsarm/rust-server-env-config","last_synced_at":"2025-10-18T07:24:43.649Z","repository":{"id":191041077,"uuid":"683553541","full_name":"mrsarm/rust-server-env-config","owner":"mrsarm","description":"Util types and functions to quickly and easy set up an HTTP server from environment variables.","archived":false,"fork":false,"pushed_at":"2024-01-31T13:47:20.000Z","size":25,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-15T01:29:10.061Z","etag":null,"topics":["config","env","environment-variables","rust","server"],"latest_commit_sha":null,"homepage":"https://docs.rs/server-env-config/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrsarm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","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-08-27T00:08:17.000Z","updated_at":"2023-08-30T12:28:40.000Z","dependencies_parsed_at":"2024-10-02T16:40:46.257Z","dependency_job_id":null,"html_url":"https://github.com/mrsarm/rust-server-env-config","commit_stats":{"total_commits":9,"total_committers":1,"mean_commits":9.0,"dds":0.0,"last_synced_commit":"38d00c987da4fd3b2701f79069ae3b43bb62350b"},"previous_names":["mrsarm/rust-server-env-config"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/mrsarm/rust-server-env-config","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrsarm%2Frust-server-env-config","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrsarm%2Frust-server-env-config/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrsarm%2Frust-server-env-config/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrsarm%2Frust-server-env-config/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrsarm","download_url":"https://codeload.github.com/mrsarm/rust-server-env-config/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrsarm%2Frust-server-env-config/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268316046,"owners_count":24231068,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-01T02:00:08.611Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["config","env","environment-variables","rust","server"],"created_at":"2024-10-02T16:30:30.747Z","updated_at":"2025-10-18T07:24:38.594Z","avatar_url":"https://github.com/mrsarm.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"server-env-config\n=================\n\nUtil types and functions to quickly and easy set up an HTTP server from\nenvironment variables (although you can omit env variables).\n\nOnce you have the Rust objects with all the basic information you need for your server,\nlike the database connection (`DATABASE_URL`), the deployment environment (`APP_ENV`)\nor the port where to start the app (`PORT`), you can use the struct objects\nto use those values to start up your Actix server, Rocket server, or whatever\nserver your app use.\n\nCheck the 📖 docs at https://docs.rs/server-env-config/.\n\n### Examples\n\n```rust\nuse std::env;\nuse server_env_config::Config;\nuse server_env_config::env::Environment;\n\n// Configurations should be actually set by the OS environment\nenv::set_var(\"APP_ENV\", \"production\");  // if not set, \"local\" is the default\nenv::set_var(\"APP_URI\", \"api/v1\");\nenv::set_var(\"PORT\", \"8080\");\nenv::set_var(\"DATABASE_URL\", \"postgresql://user:pass@localhost/db\");\n\nlet result = Config::init(9999);        // 9999 will be used if \"PORT\" is not set\nassert!(result.is_ok());\nlet config = result.unwrap();\nassert_eq!(config.env, Environment::Production);\nassert_eq!(config.server.port, 8080);\nassert_eq!(config.server.url, \"http://127.0.0.1:8080/api/v1/\");    // calculated field\nassert_eq!(config.db.database_url, \"postgresql://user:pass@localhost/db\");\n// Some settings have default values if env variables are not set\nassert_eq!(config.db.min_connections, 1);\nassert_eq!(config.db.max_connections, 10);\n// The `to_string()` method prints out all variables in .env format\nprintln!(\"{}\", config.to_string());\n// # APP_URL --\u003e http://127.0.0.1:8080/api/v1/\n// APP_URI=\"api/v1\"\n// HOST=127.0.0.1\n// PORT=8080\n// APP_ENV=production\n// DATABASE_URL=\"postgresql://user:pass@localhost/db\"\n// MIN_CONNECTIONS=1\n```\n\n### About\n\n**Project Home**: https://github.com/mrsarm/rust-actix-contrib-rest.\n\n#### Authors\n\n- Mariano Ruiz (mrsarm at gmail.com).\n\n## License\n\nThis project is licensed under either of the following licenses, at your option:\n\n- Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or [http://www.apache.org/licenses/LICENSE-2.0])\n- MIT license ([LICENSE-MIT](LICENSE-MIT) or [http://opensource.org/licenses/MIT])\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrsarm%2Frust-server-env-config","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrsarm%2Frust-server-env-config","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrsarm%2Frust-server-env-config/lists"}