Aneurin Barker Snook 11 месяцев назад
Родитель
Сommit
a359512556
3 измененных файлов с 45 добавлено и 18 удалено
  1. 1 0
      .gitignore
  2. 7 5
      LICENSE.md
  3. 37 13
      README.md

+ 1 - 0
.gitignore

@@ -1,2 +1,3 @@
 .env
 .env
 .shorty
 .shorty
+shorty

+ 7 - 5
LICENSE.md

@@ -1,9 +1,11 @@
-# License
+# MIT License
 
 
-Copyright (c) Recipeer - all rights reserved.
+Copyright © 2024 Aneurin Barker Snook a@aneur.in
 
 
-Unauthorized copying of this file or any other file in this repository is strictly prohibited.
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
 
 
-Proprietary and confidential.
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
 
 
-Aneurin Barker Snook <aneurin@recipeer.co.uk>, November 2023
+THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+https://mit-license.org/

+ 37 - 13
README.md

@@ -1,27 +1,51 @@
-# Short URL Service
+# Shorty
 
 
-A simple, static redirection service that redirects recognised paths to any other URL.
+A simple redirection service that routes any path to any URL - or in brief, a short URL service, depending on the length of your domain name.
 
 
-## Configuration
-
-Set environment variables:
+## System requirements
 
 
-- `HOST` and `PORT` configure the HTTP listen server
-- `CSV` contains redirection data in CSV format
+- [Go v1.21](https://go.dev/dl/)
 
 
-Environment variables can be set in the environment or a `.env` file.
+## Quickstart
 
 
-> :warning: CSV data **is not** loaded from a file!
+Build the app first:
 
 
-## Redirection data CSV
+```sh
+go build -o shorty
+```
 
 
-The CSV data must have two columns for the path and redirection URL, respectively. The first row is reserved for headings. Follow this example to get started:
+You can use `--help` or `-h` with any command to learn more about Shorty usage.
 
 
+```sh
+./shorty --help
 ```
 ```
-path,url
-/some/path,https://some-url.com
+
+Start the app:
+
+```sh
+./shorty start
 ```
 ```
 
 
+## Configuration
+
+Shorty can be configured via CLI flags or environment variables. Refer to help text for more detail.
+
+The most important flag is `--token|-t|SHORTY_TOKEN` which is unset by default, meaning that authentication is not enabled and anyone can modify your redirects. Set a token secretly and add it to your client to prevent unauthenticated access.
+
+## Usage
+
+You can use the following commands to manage your redirects:
+
+- `shorty add <path> <destination>` adds a redirect
+- `shorty rm <path>` removes a redirect
+- `shorty get <path>` gets the destination of a redirect
+
+These commands connect to the running Shorty instance, so you need to make sure you have started it first. Make sure to set `--token|-t|SHORTY_TOKEN` as well if you have enabled token authentication.
+
+If you provide `--url|-u|SHORTY_URL` then you can use Shorty as a remote CLI. By default it will connect to the local Shorty instance.
+
+Since all Shorty interaction goes through a REST API, it's easy to use another client (such as [Postman](https://www.postman.com/)) or develop your own client to manage Shorty. This is left as an exercise for the reader.
+
 ## License
 ## License
 
 
 See [LICENSE.md](./LICENSE.md)
 See [LICENSE.md](./LICENSE.md)