High performance self-hosted photo and video management solution.
TypeScript backup-toolfluttergoogle-photosgoogle-photos-alternativejavascriptmobile-appnestjsnodejsphoto-galleryphotosphotos-managementself-hostedsveltesveltekittypescriptvideos
feat(server): version command for immich-admin #9611 (#16924)
Abhinav Valechad0e283f687fd
diff --git a/docs/docs/administration/server-commands.md b/docs/docs/administration/server-commands.mdindex 355ee10e39..b414f5deaa 100644--- a/docs/docs/administration/server-commands.md+++ b/docs/docs/administration/server-commands.md@@ -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+```diff --git a/server/src/commands/index.ts b/server/src/commands/index.tsindex 016a26cb34..59846628bf 100644--- a/server/src/commands/index.ts+++ b/server/src/commands/index.ts@@ -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,];diff --git a/server/src/commands/version.command.ts b/server/src/commands/version.command.tsnew file mode 100644index 0000000000..585f097b6a--- /dev/null+++ b/server/src/commands/version.command.ts@@ -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();+ }+}