jhthorsen / app-mojopaste

Pastebin
38 stars 19 forks source link

Add support for other backends than "file" storage #14

Closed jhthorsen closed 6 years ago

jhthorsen commented 6 years ago

This is my idea @sklukin. This way, you can write your own Mojolicious::Plugin with the helpers paste.load and paste.save.

What do you think?

Need documentation, but I won't finish it if there's no interest.

sklukin commented 6 years ago

I like it! Good idea!

Can I copy your code to create a plugin? I will also make a pull request for the use of plugins in mojopaste.

jhthorsen commented 6 years ago

Yeah, do whatever you like with the code. In fact, I would like if you could experiment with the code in this branch to see if it works for your plugin as well.

What do you mean with "I will also make a pull request for the use of plugins in mojopaste." ?

sklukin commented 6 years ago

I meant that now the application does not know how to change the storage.

Now I realized that I can use this branch. Sorry for my english ))

jhthorsen commented 6 years ago

Sure it does: https://github.com/jhthorsen/app-mojopaste/pull/14/files#diff-124d86642865564e69122770637b1661R55

PASTE_BACKEND=Your::Awesome::Plugin script/mojopaste
sklukin commented 6 years ago

Hi! Look at https://github.com/sklukin/app-mojopaste/blob/storage/script/mojopaste This is the first working version

If you approve, I will continue

I use docker-comose for start

version: '2'
services:

  nginx_github:
    image: nginx
    restart: always
    container_name: nginx_github
    tty: true
    ports:
     - "9090:80"
    volumes:
      - ../docker:/opt/docker
      - ../docker/nginx/conf.d:/etc/nginx/conf.d:ro
    depends_on:
      - paste
    networks:
      - github

  paste:
    build: ../app-mojopaste
    image: jhthorsen/mojopaste
    container_name: paste
    hostname: paste
    restart: always
    command: "sh -c 'cd /app && exec morbo --listen='http://*:8080' ./mojopaste'"
    depends_on:
      - mongo
    volumes:
      - ../app-mojopaste/script:/app
    environment:
      PASTE_BACKEND: Mongo
    networks:
      - github

  mongo:
    image: mongo
    restart: always
    container_name: mongo
    tty: true
    networks:
      - github
jhthorsen commented 6 years ago

It looks pretty good 👍

I've made some comments on https://github.com/sklukin/app-mojopaste/commit/fe354c319886da62e3cf2e827e502949ff04b910#diff-124d86642865564e69122770637b1661

jhthorsen commented 6 years ago

I've released version 0.26 to cpan now.

Enjoy!

sklukin commented 6 years ago

Excellent! Thannks! I had things that can not be postponed. In the near future I plan to finish the plug for MongoDB