From 228bea54b0cb7726b831b512a074dd2e53455607 Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Mon, 30 Oct 2017 18:28:36 +0100 Subject: [PATCH] Updated README.md for the new configuration --- README.md | 18 ++++++++++-------- config.yml | 6 +++--- handlers/handlers_test.go | 1 - 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 1dc93ef..efef599 100644 --- a/README.md +++ b/README.md @@ -32,17 +32,19 @@ go build # Build executable Only execute the [docker-compose.yml](docker-compose.yml) and adjust the environment variables to your needs. -### Environment Variables: +### Configuration: -| Environment Variable | Description | Default Value | -| ------------------ | ----------- | ------------- | -| SHORTENER_DB_PATH | Relative or absolute path to the bolt DB | main.db | -| SHORTENER_LISTEN_ADDR | Address to which the http server should listen to | :8080 | -| SHORTENER_ID_LENGTH | Length of the random short URL id | 4 | +The configuration is a yaml based file of key value pairs. the default configuration file looks like that: + +```yaml +DBPath: main.db # Location of the bolt DB database +ListenAddr: :8080 # RemoteAddr of the http server. (IP:Port) +ShortedIDLength: 4 # Length of the random generated ID +``` ## Clients: -### Gemeral +### General There is a mechanism integrated, that you can call the `POST` endpoints with the following techniques: - application/json @@ -117,7 +119,7 @@ Next changes sorted by priority - [x] Fix handler unit tests - [x] Switch configuration to Yaml -- [ ] Add Authorization (oAuth e.g. Google) +- [ ] Add Authorization (oAuth2 e.g. Google) - [ ] Add Deletion functionality (depends on the authorization) - [ ] Performance optimization - [ ] Add ability to track the visitors (Referrer, maybe also live) diff --git a/config.yml b/config.yml index aed84d6..cb3b6f7 100644 --- a/config.yml +++ b/config.yml @@ -1,3 +1,3 @@ -DBPath: main.db -ListenAddr: :8080 -ShortedIDLength: 4 \ No newline at end of file +DBPath: main.db # Location of the bolt DB database +ListenAddr: :8080 # RemoteAddr of the http server. (IP:Port) +ShortedIDLength: 4 # Length of the random generated ID \ No newline at end of file diff --git a/handlers/handlers_test.go b/handlers/handlers_test.go index cf4645b..7d1d6b7 100644 --- a/handlers/handlers_test.go +++ b/handlers/handlers_test.go @@ -237,7 +237,6 @@ func testRedirect(t *testing.T, shortURL, longURL string) { } func getBackend() (func(), error) { - gin.SetMode(gin.ReleaseMode) store, err := store.New(testingDBName, 4) if err != nil { return nil, errors.Wrap(err, "could not create store")