chore(cli): remove commented out code

This commit is contained in:
Nicolas Meienberger 2023-08-23 08:14:40 +02:00 committed by Nicolas Meienberger
parent ac3ca00240
commit 6def5a1168
2 changed files with 5 additions and 30 deletions

View file

@ -33,28 +33,6 @@ export class AppExecutors {
return { appDataDirPath, appDirPath, configJsonPath, repoPath }; return { appDataDirPath, appDirPath, configJsonPath, repoPath };
}; };
// private ensurePermissions = async (appId: string) => {
// const { appDataDirPath, configJsonPath } = this.getAppPaths(appId);
// if (!(await pathExists(appDataDirPath))) {
// this.logger.info(`Creating app ${appId} data dir`);
// await fs.promises.mkdir(appDataDirPath, { recursive: true });
// }
// // Check if app requires special uid and gid
// if (await pathExists(configJsonPath)) {
// const config = appInfoSchema.parse(JSON.parse(await fs.promises.readFile(configJsonPath, 'utf-8')));
// const { uid, gid } = config;
// if (uid && gid) {
// this.logger.info(`Setting uid and gid to ${uid}:${gid}`);
// await execAsync(`chown -R ${uid}:${gid} ${path.join(appDataDirPath, 'data')}`);
// }
// }
// // Remove all .gitkeep files from app data dir
// await execAsync(`find ${appDataDirPath} -name '.gitkeep' -exec rm -f {} \\;`);
// };
/** /**
* Given an app id, ensures that the app folder exists in the apps folder * Given an app id, ensures that the app folder exists in the apps folder
* If not, copies the app folder from the repo * If not, copies the app folder from the repo
@ -123,8 +101,6 @@ export class AppExecutors {
await copyDataDir(appId); await copyDataDir(appId);
} }
// await this.ensurePermissions(appId);
// run docker-compose up // run docker-compose up
this.logger.info(`Running docker-compose up for app ${appId}`); this.logger.info(`Running docker-compose up for app ${appId}`);
await compose(appId, 'up -d'); await compose(appId, 'up -d');
@ -215,8 +191,6 @@ export class AppExecutors {
this.logger.info(`Copying folder ${repoPath} to ${appDirPath}`); this.logger.info(`Copying folder ${repoPath} to ${appDirPath}`);
await fs.promises.cp(repoPath, appDirPath, { recursive: true }); await fs.promises.cp(repoPath, appDirPath, { recursive: true });
// await this.ensurePermissions(appId);
await compose(appId, 'pull'); await compose(appId, 'pull');
return { success: true, message: `App ${appId} updated successfully` }; return { success: true, message: `App ${appId} updated successfully` };

View file

@ -51,8 +51,10 @@ export class SystemExecutors {
}; };
}; };
private ensureFilePermissions = async (rootFolderHost: string) => { private ensureFilePermissions = async (rootFolderHost: string, logSudoRequest = true) => {
console.log('Tipi is asking for your password to ensure file permissions are correct (performed only in runtipi folder)'); if (logSudoRequest) {
console.log('\nTipi is asking for your password\nin order to ensure permissions\non copied files and folders\n');
}
const filesAndFolders = [ const filesAndFolders = [
path.join(rootFolderHost, 'apps'), path.join(rootFolderHost, 'apps'),
path.join(rootFolderHost, 'logs'), path.join(rootFolderHost, 'logs'),
@ -65,7 +67,6 @@ export class SystemExecutors {
]; ];
// Give permission to read and write to all files and folders for the current user // Give permission to read and write to all files and folders for the current user
await Promise.all( await Promise.all(
filesAndFolders.map(async (fileOrFolder) => { filesAndFolders.map(async (fileOrFolder) => {
if (await pathExists(fileOrFolder)) { if (await pathExists(fileOrFolder)) {
@ -143,7 +144,7 @@ export class SystemExecutors {
spinner.done('System files copied'); spinner.done('System files copied');
await this.ensureFilePermissions(this.rootFolder); await this.ensureFilePermissions(this.rootFolder, false);
spinner.setMessage('Generating system env file...'); spinner.setMessage('Generating system env file...');
spinner.start(); spinner.start();