Skip to content

Commit f56de30

Browse files
committed
feat(cleanup): Make sure to remove remaining certs/proxy configs from the .lando directory as all the other files are also properly cleaned up
1 parent 851f1af commit f56de30

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

app.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,9 @@ module.exports = async (app, lando) => {
247247
// remove tooling cache
248248
app.events.on('post-uninstall', async () => await require('./hooks/app-purge-recipe-cache')(app, lando));
249249

250+
// remove proxy certs and config
251+
app.events.on('post-uninstall', async () => await require('./hooks/app-purge-proxy-certs-and-config')(app, lando));
252+
250253
// Remove meta cache on destroy
251254
app.events.on('post-destroy', async () => await require('./hooks/app-purge-metadata-cache')(app, lando));
252255

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
'use strict';
2+
3+
const fs = require('fs');
4+
const path = require('path');
5+
const remove = require('../utils/remove');
6+
7+
module.exports = async (app, lando) => {
8+
const certsDir = path.join(lando.config.userConfRoot, 'certs');
9+
const proxyConfigDir = lando.config.proxyConfigDir;
10+
11+
for (const dir of [certsDir, proxyConfigDir]) {
12+
if (!fs.existsSync(dir)) continue;
13+
fs.readdirSync(dir)
14+
.filter(f => f.includes(`.${app.project}.`))
15+
.forEach(f => {
16+
try {
17+
remove(path.join(dir, f));
18+
app.log.debug('removed proxy cert/config %s', f);
19+
} catch {
20+
app.log.debug('could not remove proxy cert/config %s', f);
21+
}
22+
});
23+
}
24+
};

0 commit comments

Comments
 (0)