yapi-user-manager is a simple, easy and fast command line tool for managing yapi users.
English | 简体中文
YApi is an efficient, easy-to-use and powerful api management platform designed to provide more elegant interface management services for developers, products and testers. It helps developers to create, publish and maintain APIs easily. YApi also provides an excellent interactive experience for users, and developers can manage interfaces by simply using the interface data writing tools and simple click operations provided by the platform.
The downside is that there is no entry point for the administrator to add users, and after our private deployment, the entry point is usually closed for security reasons, so if you want to add a new account, you need to
- modify the startup configuration
"closeRegister":false
- restart the service
- register the user
- modify the configuration to close the user registration again
"closeRegister":true
- restart the service again
As we can see, a user creation operation, which requires restarting the service twice, and seriously affect the normal use of the user, which is obviously not (very) very (not) convenient (reasonable). If you can login the server where the Yapi database is located, or you have Yapi database privileges, it becomes very convenient to manage users directly in the database. It would be great if the database statement that spells out the creation of users could be eliminated and the above function could be achieved with a single command.
Note that the configuration in the config/config.yaml file needs to be modified according to the actual situation, no matter which of the following methods is used.
Golang environment is required.
git clone https://github.com/niuzhiqiang90/yapi-user-manager.git
cd yapi-user-manager
go run main.go add user -u name -e [email protected]
Download directly from here.
tar -zxvf yapi-user-manager -linux-<version>.tar.gz
cd yapi-user-manager -linux-<version>
chmod +x yapi-user-manager
yapi-user-manager add user -u name -e [email protected]
Output
Add user successfully.
Username: xxx
Account: [email protected]
Password: 1234qwer!@#$
Please change your password after login.
yapi-user-manager reset password -e [email protected]
yapi-user-manager block user -e [email protected]
yapi-user-manager unblock user -e [email protected]
yapi-user-manager delete user -e [email protected]