{"id":19816110,"url":"https://github.com/nofeaturesonlybugs/conf","last_synced_at":"2025-05-01T10:32:15.842Z","repository":{"id":57567666,"uuid":"340746430","full_name":"nofeaturesonlybugs/conf","owner":"nofeaturesonlybugs","description":"Easy configuration files for Go.","archived":false,"fork":false,"pushed_at":"2022-06-12T16:22:04.000Z","size":41,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-07-27T22:24:49.710Z","etag":null,"topics":["conf-parser","config","config-parser","configuration","configuration-files","go","golang","ini","ini-parser"],"latest_commit_sha":null,"homepage":"","language":"Go","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/nofeaturesonlybugs.png","metadata":{"files":{"readme":"README.md","changelog":"changelog.txt","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-02-20T20:25:32.000Z","updated_at":"2022-02-16T03:51:22.000Z","dependencies_parsed_at":"2022-08-28T07:40:19.530Z","dependency_job_id":null,"html_url":"https://github.com/nofeaturesonlybugs/conf","commit_stats":null,"previous_names":[],"tags_count":5,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nofeaturesonlybugs%2Fconf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nofeaturesonlybugs%2Fconf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nofeaturesonlybugs%2Fconf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nofeaturesonlybugs%2Fconf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nofeaturesonlybugs","download_url":"https://codeload.github.com/nofeaturesonlybugs/conf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224253514,"owners_count":17280932,"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":["conf-parser","config","config-parser","configuration","configuration-files","go","golang","ini","ini-parser"],"created_at":"2024-11-12T10:08:24.839Z","updated_at":"2024-11-12T10:08:25.601Z","avatar_url":"https://github.com/nofeaturesonlybugs.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Go Reference](https://pkg.go.dev/badge/github.com/nofeaturesonlybugs/conf.svg)](https://pkg.go.dev/github.com/nofeaturesonlybugs/conf)\n[![Go Report Card](https://goreportcard.com/badge/github.com/nofeaturesonlybugs/conf)](https://goreportcard.com/report/github.com/nofeaturesonlybugs/conf)\n[![Build Status](https://app.travis-ci.com/nofeaturesonlybugs/conf.svg?branch=master)](https://app.travis-ci.com/nofeaturesonlybugs/conf)\n[![codecov](https://codecov.io/gh/nofeaturesonlybugs/conf/branch/master/graph/badge.svg)](https://codecov.io/gh/nofeaturesonlybugs/conf)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nPackage `conf` parses configuration data and populates a Go `struct` with the results.\n\nThe package documentation contains the configuration EBNF but here are some syntax examples:\n\n## Comments\n\n```ini\n# Lines beginning with punctuation are comments.\n; Any punctuation except [] can begin a comment.\n^ Just know that syntax highlighters won't always know what to do!\n```\n\n## Keys and Values\n\n```\nkey = value\nkeys can have spaces = values run until the end of the line\nkeys.can.have.punctuation = so can values!\n\nvalues can be quoted = 'This value is quoted!'\nquotes preserve whitespace = `\nThis value\nspans\n4 lines!`\n\n# Quotes are only recognized if they are matching runes at the beginning and end of a value.\nnot quoted = asdf '\" fdsa\n\n# Quotes can be used to add quote characters to the parsed value.\nquotes picked up = `\"Hello!\" said Dave.`\n```\n\n## Invalid Keys\n\n```\n# Invalid - whitespace must be followed by [a-z0-9]\nkey . = oops\n\n# Invalid - multiple punctuation not allowed\nkey.. = oops again\n\n# Invalid - punctuation must join [a-z0-9] to [a-z0-9] without whitespace\nkey . key_extra = nope\n```\n\n## Sections\n\nCreate a section with square brackets:\n\n```\n# These values are global\nkey1 = value1\nkey2 = value2\n\n# This is a section named: color\n[ color ]\nname = red\nrgb = #ff0000\n```\n\n## Lists Require No Special Syntax\n\nCreate lists in your configuration by simply repeating `keys` or `sections`:\n\n```\nfruits = apples\nfruits = oranges\nfruits = bananas\n\n[ color ]\nname = red\nrgb = ff0000\n\n[ color ]\nname = blue\nrgb = 0000ff\n\n[ color ]\nname = green\nrgb = 00ff00\n```\n\n## Easily Populate a Conf Struct\n\nCreate a `struct` matching the configuration.\n\nThis `struct` is for the configuration just prior:\n\n```go\ntype T struct {\n    Fruits []string `conf:\"fruits\"`\n\n    Color []struct {\n        Name string `conf:\"name\"`\n        Rgb  string `conf:\"rgb\"`\n    } `conf:\"color\"`\n}\n```\n\nConsume the configuration either as a `string` or `file`.\n\n```go\nconf, err := conf.String(s)\nif err != nil {\n    fmt.Println(err.Error())\n}\n```\n\nWe're using `FillByTag` to map the lowercase config values to our uppercase `struct` members:\n\n```go\nvar t T\nif err = conf.FillByTag(\"conf\", \u0026t); err != nil {\n    fmt.Println(err.Error())\n}\nfmt.Printf(\"%v\\n\", t.Fruits)\nfor _, color := range t.Color {\n    fmt.Printf(\"%v %v\\n\", color.Name, color.Rgb)\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnofeaturesonlybugs%2Fconf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnofeaturesonlybugs%2Fconf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnofeaturesonlybugs%2Fconf/lists"}