{"id":18903773,"url":"https://github.com/bububa/goconfig","last_synced_at":"2026-03-04T07:30:16.372Z","repository":{"id":57481905,"uuid":"16507205","full_name":"bububa/goconfig","owner":"bububa","description":"golang config","archived":false,"fork":false,"pushed_at":"2015-05-23T02:57:40.000Z","size":367,"stargazers_count":0,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-31T10:16:10.728Z","etag":null,"topics":[],"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/bububa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-02-04T09:16:57.000Z","updated_at":"2021-06-18T16:48:23.000Z","dependencies_parsed_at":"2022-09-02T06:10:22.936Z","dependency_job_id":null,"html_url":"https://github.com/bububa/goconfig","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bububa%2Fgoconfig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bububa%2Fgoconfig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bububa%2Fgoconfig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bububa%2Fgoconfig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bububa","download_url":"https://codeload.github.com/bububa/goconfig/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239888299,"owners_count":19713690,"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":[],"created_at":"2024-11-08T09:06:19.456Z","updated_at":"2026-03-04T07:30:16.313Z","avatar_url":"https://github.com/bububa.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"goconfig\n========\n\nThis package implements a basic configuration file parser language which\nprovides a structure similar to what you would find on Microsoft Windows INI\nfiles.\n\nThe configuration file consists of sections, led by a \"*[section]*\" header and\nfollowed by \"*name: value*\" entries; \"*name=value*\" is also accepted. Note that\nleading whitespace is removed from values. The optional values can contain\nformat strings which refer to other values in the same section, or values in a\nspecial *DEFAULT* section. Additional defaults can be provided on initialization\nand retrieval. Comments are indicated by \";\" or \"#\"; a comment may begin\nanywhere on a line, including on the same line after parameters or section\ndeclarations.\n\nFor example:\n\n\t[My Section]\n\tfoodir: %(dir)s/whatever\n\tdir=foo\n\nwould resolve the \"*%(dir)s*\" to the value of \"*dir*\" (*foo* in this case). All\nreference expansions are done on demand.\n\nThe functionality and workflow is loosely based on the *configparser* package of\nthe Python Standard Library.\n\n\n## Installation\n\n\tgo get github.com/kless/goconfig/config\n\nTo run the tests:\n\n\tcd ${GOPATH//:*}/src/github.com/kless/goconfig/config \u0026\u0026 go test \u0026\u0026 cd -\n\n\n## Operating instructions\n\nGiven a sample configuration file:\n\n\t[DEFAULT]\n\thost: www.example.com\n\tprotocol: http://\n\tbase-url: %(protocol)s%(host)s\n\n\t[service-1]\n\turl: %(base-url)s/some/path\n\tdelegation: on\n\tmaxclients: 200 # do not set this higher\n\tcomments: This is a multi-line\n\t\tentry\t# And this is a comment\n\nTo read this configuration file, do:\n\n\tc, _ := config.ReadDefault(\"config.cfg\")\n\n\tc.String(\"service-1\", \"url\")\n\t// result is string \"http://www.example.com/some/path\"\n\n\tc.Int(\"service-1\", \"maxclients\")\n\t// result is int 200\n\n\tc.Bool(\"service-1\", \"delegation\")\n\t// result is bool true\n\n\tc.String(\"service-1\", \"comments\")\n\t// result is string \"This is a multi-line\\nentry\"\n\nNote the support for unfolding variables (such as *%(base-url)s*), which are read\nfrom the special (reserved) section name *[DEFAULT]*.\n\nA new configuration file can also be created with:\n\n\tc := config.NewDefault()\n\tc.AddSection(\"Section\")\n\tc.AddOption(\"Section\", \"option\", \"value\")\n\tc.WriteFile(\"config.cfg\", 0644, \"A header for this file\")\n\nThis results in the file:\n\n\t# A header for this file\n\n\t[Section]\n\toption: value\n\nNote that sections, options and values are all case-sensitive.\n\n\n## Copyright and licensing\n\n*Copyright 2009  The \"goconfig\" Authors*. See file AUTHORS and CONTRIBUTORS.  \nUnless otherwise noted, the source files are distributed under the\n*Apache License, version 2.0* found in the LICENSE file.\n\n\n* * *\n*Generated by [GoWizard](https://github.com/kless/GoWizard)*\n\n=======\ngolang config\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbububa%2Fgoconfig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbububa%2Fgoconfig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbububa%2Fgoconfig/lists"}