HUB
Sign inSign up

yeliex/snowflake

By yeliex

•Updated over 6 years ago

server to generate uniq-id with twitter-snowflake arithmetic

Image
0

7.9K

yeliex/snowflake repository overview

⁠snowflake

server to generate uniq-id with twitter-snowflake arithmetic

https://hub.docker.com/r/yeliex/snowflake/ https://hub.docker.com/r/yeliex/snowflake/ https://npmjs.org/package/@yeliex/snowflake

⁠Usage
$ docker run -p 3000:3000 --name snowflake yeliex/snowflake
$ curl localhost:3000
# or
$ curl localhost:3000?type=json
# or
$ curl -H "Accept: application/json" localhost:3000

⁠Authorization

$ docker run -p 3000:3000 --name snowflake -v ./config:/snowflake/config yeliex/snowflake

# config/config.yml
security:
  token:
    - token1
    - token2
    
$ curl -H "X-TOKEN: token1" localhost:3000
# OR
$ curl localhost:3000?token=token1
⁠Configuration
  • production: /snowflake/config.yml
  • development: ./config/config.yml
# Server base
server:
  listenPort: 3000

snowflake:
  region: 1
  worker: 1
  endpoint: 1 # replace region and worker

security:
  token: # if empty, run without auth
    - token1
    - token2
⁠api
⁠ALL /_health

health check

⁠GET /

gen id

⁠Return json

/?type=json OR header Accept: application/json

⁠Auth

/?token=token OR header X-Token: token

Tag summary
Recent tags
Content type
Image
Digest
Size
40.7 MB
Last updated
over 6 years ago
docker pull yeliex/snowflake:latest