{"id":30670633,"url":"https://github.com/tmaiaroto/discfg","last_synced_at":"2026-03-11T15:31:15.253Z","repository":{"id":57500198,"uuid":"45318627","full_name":"tmaiaroto/discfg","owner":"tmaiaroto","description":"A distributed, serverless, configuration tool using AWS services","archived":false,"fork":false,"pushed_at":"2018-10-25T14:43:39.000Z","size":220,"stargazers_count":74,"open_issues_count":11,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-10-14T18:39:03.224Z","etag":null,"topics":["aws-lambda","dynamodb","golang","serverless"],"latest_commit_sha":null,"homepage":"","language":"Go","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/tmaiaroto.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-31T21:14:56.000Z","updated_at":"2024-10-18T18:49:04.000Z","dependencies_parsed_at":"2022-08-28T20:01:38.134Z","dependency_job_id":null,"html_url":"https://github.com/tmaiaroto/discfg","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/tmaiaroto/discfg","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmaiaroto%2Fdiscfg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmaiaroto%2Fdiscfg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmaiaroto%2Fdiscfg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmaiaroto%2Fdiscfg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tmaiaroto","download_url":"https://codeload.github.com/tmaiaroto/discfg/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmaiaroto%2Fdiscfg/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30385981,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-11T14:10:17.325Z","status":"ssl_error","status_checked_at":"2026-03-11T14:09:37.934Z","response_time":84,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["aws-lambda","dynamodb","golang","serverless"],"created_at":"2025-09-01T02:44:14.211Z","updated_at":"2026-03-11T15:31:15.211Z","avatar_url":"https://github.com/tmaiaroto.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"https://raw.githubusercontent.com/tmaiaroto/discfg/master/docs/logo.png?a\" width=\"350\" align=\"middle\" alt=\"Distributed Config (discfg)\" /\u003e\n\n[![License Apache 2](https://img.shields.io/badge/license-Apache%202-blue.svg)](https://github.com/tmaiaroto/discfg/blob/master/LICENSE) [![godoc discfg](https://img.shields.io/badge/godoc-reference-blue.svg)](http://godoc.org/github.com/tmaiaroto/discfg) [![Build Status](https://travis-ci.org/tmaiaroto/discfg.svg?branch=master)](https://travis-ci.org/tmaiaroto/discfg) [![goreport discfg](https://goreportcard.com/badge/github.com/tmaiaroto/discfg)](https://goreportcard.com/report/github.com/tmaiaroto/discfg)\n\nA serverless and distributed (key/value) configuration tool built on top of Amazon Web Services. Specifically,\nit aims to use Lambda, DyanmoDB, and API Gateway. Though it can be used with other services.\n\nIt can install to your system as a binary, so managing configuration from any machine is simple from \na command line. You can also work with configurations via RESTful API.\n\n### Command Line Interface\n\nAssuming you built and/or installed the ```discfg``` binary and you have your AWS credentials under ```~/.aws``` \nbecause you've used the AWS CLI tool before and configured them...\n\n```\n./discfg create mycfg    \n./discfg use mycfg    \n./discfg set mykey '{\"json\": \"works\"}'    \n./discfg set mykey -d file.json\n```\n\nThat first command creates a configuration for you (a table in DynamoDB - US East region by default). \nAfter that you can set keys from values passed to the CLI or from a file on disk. All values ultimately \nget stored as binary data, so you could even store (small - DynamoDB size limits) files if you really \nwanted to; images, maybe icons, for example.\n\nNote: If you did not want to call the ```use``` command or if you need to work with multiple configurations,\nyou can always get and set keys by passing the configuration name. So the following ```set``` command is\nthe same as the one above:\n\n```\n./discfg set mycfg mykey '{\"json\": \"works\"}'\n```\n\nAlso note that the slash is optional. All keys without a forward slash will have one prepended automatically. \nThat is to say they will be at the root level. Now to retrieve this value:\n\n```\n./discfg get mykey\n```\n\nTo retrieve the value as a JSON response run (and jq is handy here; https://stedolan.github.io/jq):\n\n```\n./discfg get mykey -f json\n```\n\nYou should see something like this:\n\n```\n{\n  \"action\": \"get\",\n  \"item\": {\n    \"version\": 2,\n    \"key\": \"mykey\",\n    \"value\": {\n      \"foo\": \"test\"\n    }\n  },\n  \"prevItem\": {}\n}\n```\n\nNOTE: You will only see ```prevItem``` populated upon an update. discfg does not store a history\nof item values.\n\n### Serverless API\n\nThe serverless API was built using the [Apex](http://apex.run/) framework along with [Terraform](https://www.terraform.io/).\nThis leverages AWS Lambda and API Gateway. Assuming you have AWS CLI setup and then setup Apex \nand Terraform, you could then easily deploy discfg (from the `apex` directory) with the following.\n\nYou'll first need the Apex go shim if you don't already have it:\n\n```\ngo get github.com/apex/go-apex\n```\n\nThen you can setup the infrastructure and deploy with:\n\n```\napex infra get\napex infra apply -var 'aws_account_id=XXXXX'\napex deploy\n```\n\nWhere `XXXXX` has been replaced with your Amazon Web Services Account ID. Note that within the\n`infrastructure` directory, you'll find all the `.tf` files. Feel free to adjust those in the\n`variables.tf` to change simple things like the API name. You can also dig even deeper to change \nmore complex things or course you can change things from the AWS web console once you've deployed\nthe default provided.\n\n#### Example API Calls\n\nYou'll of course prepend these URL paths with your AWS API Gateway API's base URL.\n\n**PUT /{name}/keys/{key}**\n\nBody\n```\nany value\n```\n\nWould set the provided value from he PUT body for the config name and key name passed\nin the API endpoint path parameters. There would then be a JSON response.\n\n**GET /{name}/keys/{key}**\n\nWould get the key value for the given key name and config name passed in the API endpoint\npath parameters. The response would be a JSON message.\n\n\n**PUT /{name}/cfg**\n\nBody\n```\n{\"WriteCapacityUnits\": 2, \"ReadCapacityUnits\": 4}\n```\n\nWould create a table in DynamoDB with the provided name in the API endpoint path and would\nalso configure it with the given settings from the PUT body. In the case of DynamoDB these \nsetings are the read and write capacity units (by default 1 write and 2 read).\n\n\n### Running the API Server (on a server)\n\nWhile discfg is meant to be a tool for a \"serverless\" architecture, it doesn't mean you can't\nrun it on your own server. Currently, there is no storage engine that would keep the data on \nthe same server (and that defeats the whole purpose of being distributed), but the RESTful API \ncan certainly be hosted on any server. So you can work with your configurations using JSON\ninstead of just on the CLI or having to bring discfg into your own Go package.\n\nThe API server can be on your local machine, or a remote server. Or both. The point is convenience.\n\nCurrently, discfg has no authentication built in. _Do not run it exposed to the world._ \nThe point of relying on AWS is that Amazon provides you with the ability to control access.\nFrom the API server exposed through API Gateway to the DynamoDB database.\n\nYou'll find the API server under the `server` directory. If you have the project cloned from\nthe repo, you could simply go to that directory and run `go main.go v1.go` to check it out.\nYou'll ultimatley want to build a binary and run it from where ever you need.\n\nIt runs on port `8899` by default, but you can change that with a `--port` flag. Also note\nthat discfg only uses AWS for storage engines right now so you should be sure to pay attention\nto the AWS region. It's `us-east-1` by default, but you can change that too with a `region` flag.\n\n## What prompted this tool?\n\nThe need for a serverless application configuration. When dealing with AWS Lambda, state and \nconfiguration become a regular issue with no consistent solution. This ends up becoming a bit\nof boilerplate code in each of your functions.\n\nDiscfg solves this need by making it very easy to work with key/value configuration data.\n\nOf course your application need not be serverless or run in AWS Lambda to benefit from discfg.\n\nManaging a bunch of environment variables isn't scalable. It's annoying and when you go to deploy\nor have a co-worker work on the project, it becomes a hassle. Even with tools like Docker. Things\nchange and keeping on top of configuration changes is simply annoying with environment variables.\n\nLikewise, dropping an .ini or .json or .env file into a project is also not a terrific solution.\nConfiguration files also become quickly dated and it still doesn't help much when you need to\nshare configurations with others.\n\nEssentially, discfg is an interface around DynamoDB (and other distributed storage solutions).\nOpposed to some other configuration tools, it's not responsible for the distributed storage itself.\n\nEtcd was a big inspiration for this project. However, etcd is not \"serverless\" and so it requires one\nto set up and maintain a cluster of servers. This is a little less convenient, though the tool itself\nis also much faster. There's a trade off for convenience. Discfg was meant for higher level application\nuse and so the performance factor wasn't a concern. The feature set of discfg also started to diverge\nfrom etcd as well. Discfg is simply a tool with a different use case.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftmaiaroto%2Fdiscfg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftmaiaroto%2Fdiscfg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftmaiaroto%2Fdiscfg/lists"}