feat(profile): display version number from .env in profile menu (#182)
* feat(profile): display version number from .env in profile menu * Update version checking process --------- Co-authored-by: LukeGus <[email protected]>
This commit was merged in pull request #182.
This commit is contained in:
1 parent
aa04597e16
commit
dfb50ed8b1
6 files changed
+47
-36
No files matched your search
@@ -147,22 +147,16 @@ app.get('/health', (req, res) => {
|
||||
|
||||
app.get('/version', async (req, res) => {
|
||||
let localVersion = process.env.VERSION;
|
||||
|
||||
// Fallback to package.json version if env variable not set
|
||||
|
||||
if (!localVersion) {
|
||||
try {
|
||||
const packagePath = path.resolve(process.cwd(), 'package.json');
|
||||
const packageJson = JSON.parse(fs.readFileSync(packagePath, 'utf8'));
|
||||
localVersion = packageJson.version;
|
||||
logger.info(`Using version from package.json: ${localVersion}`);
|
||||
} catch (error) {
|
||||
logger.error('Failed to read version from package.json:', error);
|
||||
}
|
||||
}
|
||||
|
||||
// Debug logging
|
||||
logger.debug(`Final version: ${localVersion}`);
|
||||
logger.debug(`Working directory: ${process.cwd()}`);
|
||||
|
||||
if (!localVersion) {
|
||||
logger.error('No version information available');
|
||||
@@ -186,6 +180,7 @@ app.get('/version', async (req, res) => {
|
||||
|
||||
const response = {
|
||||
status: localVersion === remoteVersion ? 'up_to_date' : 'requires_update',
|
||||
localVersion: localVersion,
|
||||
version: remoteVersion,
|
||||
latest_release: {
|
||||
tag_name: releaseData.data.tag_name,
|
||||
|
||||
Reference in new issue
Block a user