{"id":13564066,"url":"https://github.com/magiconair/properties","last_synced_at":"2025-04-03T21:30:22.796Z","repository":{"id":42429370,"uuid":"15127266","full_name":"magiconair/properties","owner":"magiconair","description":"Java properties scanner for Go","archived":false,"fork":false,"pushed_at":"2024-12-08T12:57:14.000Z","size":358,"stargazers_count":331,"open_issues_count":18,"forks_count":80,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-03-31T16:14:38.726Z","etag":null,"topics":["go","golang","golang-library","properties"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/magiconair.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2013-12-12T04:55:17.000Z","updated_at":"2025-03-12T22:05:07.000Z","dependencies_parsed_at":"2024-12-24T13:09:30.316Z","dependency_job_id":"49ec6024-a127-4e40-a18a-45274c189b02","html_url":"https://github.com/magiconair/properties","commit_stats":{"total_commits":225,"total_committers":23,"mean_commits":9.782608695652174,"dds":0.4222222222222223,"last_synced_commit":"c9a06e8f8f0164e4e16c0d5c4793cbed4ac90264"},"previous_names":["magiconair/goproperties","magiconair/go-properties"],"tags_count":32,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magiconair%2Fproperties","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magiconair%2Fproperties/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magiconair%2Fproperties/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magiconair%2Fproperties/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/magiconair","download_url":"https://codeload.github.com/magiconair/properties/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247082750,"owners_count":20880711,"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","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":["go","golang","golang-library","properties"],"created_at":"2024-08-01T13:01:26.224Z","updated_at":"2025-04-03T21:30:22.790Z","avatar_url":"https://github.com/magiconair.png","language":"Go","funding_links":[],"categories":["开源类库","Go","Open source library"],"sub_categories":["解释器","Interpreter"],"readme":"[![](https://img.shields.io/github/tag/magiconair/properties.svg?style=flat-square\u0026label=release)](https://github.com/magiconair/properties/releases)\n[![License](https://img.shields.io/badge/License-BSD%202--Clause-orange.svg?style=flat-square)](https://raw.githubusercontent.com/magiconair/properties/master/LICENSE)\n[![GoDoc](http://img.shields.io/badge/godoc-reference-5272B4.svg?style=flat-square)](http://godoc.org/github.com/magiconair/properties)\n\n# Overview\n\nproperties is a Go library for reading and writing properties files.\n\nIt supports reading from multiple files or URLs and Spring style recursive\nproperty expansion of expressions like `${key}` to their corresponding value.\nValue expressions can refer to other keys like in `${key}` or to environment\nvariables like in `${USER}`.  Filenames can also contain environment variables\nlike in `/home/${USER}/myapp.properties`.\n\nProperties can be decoded into structs, maps, arrays and values through\nstruct tags.\n\nComments and the order of keys are preserved. Comments can be modified\nand can be written to the output.\n\nThe properties library supports both ISO-8859-1 and UTF-8 encoded data.\n\nStarting from version 1.3.0 the behavior of the MustXXX() functions is\nconfigurable by providing a custom `ErrorHandler` function. The default has\nchanged from `panic` to `log.Fatal` but this is configurable and custom\nerror handling functions can be provided. See the package documentation for\ndetails.\n\nRead the full documentation on [![GoDoc](http://img.shields.io/badge/godoc-reference-5272B4.svg?style=flat-square)](http://godoc.org/github.com/magiconair/properties)\n\n## Getting Started\n\n```go\nimport (\n\t\"flag\"\n\t\"github.com/magiconair/properties\"\n)\n\nfunc main() {\n\t// init from a file\n\tp := properties.MustLoadFile(\"${HOME}/config.properties\", properties.UTF8)\n\n\t// or multiple files\n\tp = properties.MustLoadFiles([]string{\n\t\t\t\"${HOME}/config.properties\",\n\t\t\t\"${HOME}/config-${USER}.properties\",\n\t\t}, properties.UTF8, true)\n\n\t// or from a map\n\tp = properties.LoadMap(map[string]string{\"key\": \"value\", \"abc\": \"def\"})\n\n\t// or from a string\n\tp = properties.MustLoadString(\"key=value\\nabc=def\")\n\n\t// or from a URL\n\tp = properties.MustLoadURL(\"http://host/path\")\n\n\t// or from multiple URLs\n\tp = properties.MustLoadURL([]string{\n\t\t\t\"http://host/config\",\n\t\t\t\"http://host/config-${USER}\",\n\t\t}, true)\n\n\t// or from flags\n\tp.MustFlag(flag.CommandLine)\n\n\t// get values through getters\n\thost := p.MustGetString(\"host\")\n\tport := p.GetInt(\"port\", 8080)\n\n\t// or through Decode\n\ttype Config struct {\n\t\tHost    string        `properties:\"host\"`\n\t\tPort    int           `properties:\"port,default=9000\"`\n\t\tAccept  []string      `properties:\"accept,default=image/png;image;gif\"`\n\t\tTimeout time.Duration `properties:\"timeout,default=5s\"`\n\t}\n\tvar cfg Config\n\tif err := p.Decode(\u0026cfg); err != nil {\n\t\tlog.Fatal(err)\n\t}\n}\n\n```\n\n## Installation and Upgrade\n\n```\n$ go get -u github.com/magiconair/properties\n```\n\n## License\n\n2 clause BSD license. See [LICENSE](https://github.com/magiconair/properties/blob/master/LICENSE) file for details.\n\n## ToDo\n\n* Dump contents with passwords and secrets obscured\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagiconair%2Fproperties","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmagiconair%2Fproperties","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagiconair%2Fproperties/lists"}