Skip to content

Rotten-LKZ/valaxy-admin-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

valaxy-admin-server

Server for blogs using Valaxy

Web app for admin

Desktop app for admin

Api requests

Usage

  1. Install dependencies
pnpm i
  1. Config the server

Create file .env in root path and set config
MONGO_LINK=link for connecting MongoDb mongodb://[username:password@]<host>[:port]/<database>?retryWrites=true&w=majority

MANAGER_USERNAME=username for logging in admin e.g. admin
MANAGER_PASSWORD=password for logging in admin e.g. admin
MANAGER_SECRET_KEY=secret key for generating JWT

BASE_URL=base url, it will be spliced with the image address (Required "/") e.g. http://172.23.107.93:3011/v1/
REDIRECT_URL=redirect after a client is requesting a picture (If this option is undefined, it will response image immediately. Not required "/") e.g. http://127.0.0.1:6543

WHITE_LIST=cors e.g. ["123", "123"] (If this option is undefined, it will allow all requests)

COMMAND=the command to be executed e.g. /root/test/upload.sh (If this option is undefined, it will run git add . git commit -m "chore: update" git push -f)

  1. Create Valaxy under template and use git to push it to github (Remember to use npm and git env is required)

This program is using git push -f to push, so make sure that you have permission to force push and there is no conflict to avoid data loss.

  1. Create folder upload

  2. Start the server

pnpm dev

Notice

  1. Api v1/image with POST will delay inserting image information into the database, which means that you can't read all image information from the database at the first time, especially uploading too many images at one time.

  2. If you upload a file with the same file name within a day, the old file will be overwritten