{"id":19010309,"url":"https://github.com/railsware/go-global","last_synced_at":"2025-04-22T23:12:07.566Z","repository":{"id":40505704,"uuid":"266691872","full_name":"railsware/go-global","owner":"railsware","description":"Golang configuration reader for AWS Parameter Store and more","archived":false,"fork":false,"pushed_at":"2025-03-19T16:23:10.000Z","size":56,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":14,"default_branch":"v2","last_synced_at":"2025-04-22T23:11:49.269Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/railsware.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2020-05-25T05:34:18.000Z","updated_at":"2025-03-19T16:22:02.000Z","dependencies_parsed_at":"2024-11-08T19:10:56.364Z","dependency_job_id":"7a74ae37-a79b-4442-b3e4-239745e02aac","html_url":"https://github.com/railsware/go-global","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/railsware%2Fgo-global","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/railsware%2Fgo-global/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/railsware%2Fgo-global/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/railsware%2Fgo-global/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/railsware","download_url":"https://codeload.github.com/railsware/go-global/tar.gz/refs/heads/v2","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250337946,"owners_count":21414104,"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-08T19:10:48.176Z","updated_at":"2025-04-22T23:12:07.478Z","avatar_url":"https://github.com/railsware.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go companion modules for Ruby Global gem\n\nThis repository contains modules to load configuration analogous to the [Global gem](https://github.com/railsware/global). Refere to Global's documentation for more details\n\n## AWS Parameter Store usage example\n\nSee [main Global documentation](https://github.com/railsware/global#aws-parameter-store-1) for setup instructions.\n\n```sh\ngo get github.com/railsware/go-global/v2/aws\n```\n\n```go\nimport (\n  \"os\"\n  awsConfig \"github.com/aws/aws-sdk-go-v2/config\"\n  globalAWS \"github.com/railsware/go-global/v2/aws\"\n)\n\ntype Config struct {\n  Database struct {\n    PoolSize int `json:\"pool_size\"`\n    URLs []string `json:\"urls\"`\n  } `json:\"database\"`\n\n}\n\nvar config Config\n\nawsConfig, err := awsConfig.LoadDefaultConfig(context.TODO())\nif err != nil {\n  log.Fatalf(\"cannot load aws config: %v\", err)\n}\nawsParamPrefix := os.Getenv(\"AWS_PARAM_PREFIX\")\n\nerr := globalAWS.LoadConfigFromParameterStore(\n  awsConfig,\n  globalAWS.LoadConfigOptions{ParamPrefix: awsParamPrefix},\n  \u0026config\n)\n\n// config.Database.URLs[0] loaded from /param_prefix/database/urls/0\n// config.Database.PoolSize loaded from /param_prefix/database/pool_size\n```\n\n- Supported value types: `string`, `int`, `bool` (\"true\"/\"false\").\n\n- A `[]byte` can be loaded from Base64 encoded string.\n\n- Complex type should be either a `struct`, a `map` or a `slice`. You can arbitrarily nest them.\n\n- For structs, use `global` or `json` tag to set field name.\n\n- For maps, the key name is the map key (maps must use strings as keys.)\n\n- For slices, all subscripts in Parameter Store must be integers.\n\n### Shorthand for running on AWS ECS or Lambda\n\nIf you use Global in AWS environments, you can DRY up the code by following a convention:\n\n- Set up param prefix in the `AWS_PARAM_PREFIX` environment variable.\n- Make sure the IAM role has permissions to the params\n\nThen you can simply use:\n\n```go\nvar config Config\n// Will panic if anything goes wrong\nglobalAWS.MustLoadConfig(\u0026config)\n```\n\n### Handling unmapped params\n\nBy default, Global assumes that all params from Parameter Store must be mapped to config fields, and returns a warning if some param does not correspond to a config field.\n\nSometimes, it is expected that the config only contains a subset of the params, and such a warning is unnecessary.\n\nIn this case, set `options.IgnoreUnmappedParams` to true. Note that other mapping issues, like a type mismatch, will still cause an error.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frailsware%2Fgo-global","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frailsware%2Fgo-global","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frailsware%2Fgo-global/lists"}