mirror of
https://github.com/immich-app/immich.git
synced 2025-03-18 02:31:28 -05:00
* feat(server): Add version command for immich-admin #9611 * chore: clean up --------- Co-authored-by: Jason Rasmussen <jason@rasm.me>
This commit is contained in:
parent
f8b40188e2
commit
d0e283f687
3 changed files with 34 additions and 0 deletions
|
@ -11,6 +11,7 @@ The `immich-server` docker image comes preinstalled with an administrative CLI (
|
|||
| `enable-oauth-login` | Enable OAuth login |
|
||||
| `disable-oauth-login` | Disable OAuth login |
|
||||
| `list-users` | List Immich users |
|
||||
| `version` | Print Immich version |
|
||||
|
||||
## How to run a command
|
||||
|
||||
|
@ -80,3 +81,10 @@ immich-admin list-users
|
|||
}
|
||||
]
|
||||
```
|
||||
|
||||
Print Immich Version
|
||||
|
||||
```
|
||||
immich-admin version
|
||||
v1.129.0
|
||||
```
|
||||
|
|
|
@ -2,6 +2,7 @@ import { ListUsersCommand } from 'src/commands/list-users.command';
|
|||
import { DisableOAuthLogin, EnableOAuthLogin } from 'src/commands/oauth-login';
|
||||
import { DisablePasswordLoginCommand, EnablePasswordLoginCommand } from 'src/commands/password-login';
|
||||
import { PromptPasswordQuestions, ResetAdminPasswordCommand } from 'src/commands/reset-admin-password.command';
|
||||
import { VersionCommand } from 'src/commands/version.command';
|
||||
|
||||
export const commands = [
|
||||
ResetAdminPasswordCommand,
|
||||
|
@ -11,4 +12,5 @@ export const commands = [
|
|||
EnableOAuthLogin,
|
||||
DisableOAuthLogin,
|
||||
ListUsersCommand,
|
||||
VersionCommand,
|
||||
];
|
||||
|
|
24
server/src/commands/version.command.ts
Normal file
24
server/src/commands/version.command.ts
Normal file
|
@ -0,0 +1,24 @@
|
|||
import { Command, CommandRunner } from 'nest-commander';
|
||||
import { VersionService } from 'src/services/version.service';
|
||||
|
||||
@Command({
|
||||
name: 'version',
|
||||
description: 'Print Immich version',
|
||||
})
|
||||
export class VersionCommand extends CommandRunner {
|
||||
constructor(private service: VersionService) {
|
||||
super();
|
||||
}
|
||||
|
||||
run(): Promise<void> {
|
||||
try {
|
||||
const version = this.service.getVersion();
|
||||
console.log(`v${version.major}.${version.minor}.${version.patch}`);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
console.error('Unable to get version');
|
||||
}
|
||||
|
||||
return Promise.resolve();
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue