summaryrefslogtreecommitdiffstats
path: root/go/README.markdown
blob: 2d4ba9097b0f0fc9b2a33ea10b56b4c932792340 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# go - minimalistic uri shortener

## install dependencies

    npm install

  apparently you can also

    npm install hiredis

  for more awesome.

## run service

    HOSTN=go PORT=80 URI_PREFIX=http://go node .

  if you omit `HOSTN`, then relative shortened uris will be generated.
  if you omit `PORT`, then it's `1337`.
  if you omit `URI_PREFIX`, then it will be generated from `HOSTN` änd `PORT`.

  there's also the possibility to change the Redis key prefix which
  defaults to `go:` with

    REDIS_KEY_PREFIX=foobarmyprefix/

  to generate slightly more informative shortened uris set

    NOT_SO_SHORT=true

## add uri

    curl -F uri=https://mywaytoolonguri http://go

  this will give you a shortened uri.

## resolve uri

    curl -L http://go/1

## clear database

    redis-cli keys 'go:*' | xargs redis-cli del

  if you have changed `redisPrefix`, then use that instead of `go:`.

## use systemd

  run

    make install

  to install the systemd service and configuration files.
  this will fail if the files are already installed and modified.

  configure `HOSTN` and `PORT` in `/etc/conf.d/go.env` and the user
  and/or group in `/etc/systemd/system/go.service`.

  and finally start the service with

    systemctl start go