Skip to content

Commit 851f1af

Browse files
committed
feat(generate-certs): Generate certs in the ready event (and only once per composeCache (app start)) so that you can also run lando exec without starting first and bump the validity to 10 years
1 parent 645ddcb commit 851f1af

4 files changed

Lines changed: 11 additions & 5 deletions

File tree

app.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ module.exports = async (app, lando) => {
157157
// override default tooling commands if needed
158158
app.events.on('ready', 1, async () => await require('./hooks/app-override-tooling-defaults')(app, lando));
159159

160+
// Generate certs for v3 SSL services as needed
161+
app.events.on('ready', 2, async () => await require('./hooks/app-generate-v3-certs')(app, lando));
162+
160163
// set tooling compose cache
161164
app.events.on('ready', async () => await require('./hooks/app-set-compose-cache')(app, lando));
162165

@@ -190,9 +193,6 @@ module.exports = async (app, lando) => {
190193
// Check for updates if the update cache is empty
191194
app.events.on('pre-start', 1, async () => await require('./hooks/app-check-for-updates')(app, lando));
192195

193-
// Generate certs for v3 SSL services as needed
194-
app.events.on('pre-start', 2, async () => await require('./hooks/app-generate-v3-certs')(app, lando));
195-
196196
// If the app already is installed but we can't determine the builtAgainst, then set it to something bogus
197197
app.events.on('pre-start', async () => await require('./hooks/app-update-built-against-pre')(app, lando));
198198

hooks/app-generate-v3-certs.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ const parseUrls = (urls = []) => {
1515
};
1616

1717
module.exports = async (app, lando) => {
18+
if (lando.cache.get(app.composeCache)) return;
19+
1820
const certServices = app.info
1921
.filter(service => service.hasCerts === true)
2022
.map(service => ({

hooks/lando-clean-networks.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
// Modules
44
const _ = require('lodash');
55

6-
module.exports = async lando => lando.engine.getNetworks().then(networks => {
6+
module.exports = async lando => {
7+
if (lando.cache.get('_.networks.checked')) return;
8+
lando.cache.set('_.networks.checked', true);
9+
return lando.engine.getNetworks().then(networks => {
710
if (_.size(networks) >= lando.config.networkLimit) {
811
// Warn user about this action
912
lando.log.warn('Lando has detected you are at Docker\'s network limit!');
@@ -37,3 +40,4 @@ module.exports = async lando => lando.engine.getNetworks().then(networks => {
3740
});
3841
}
3942
});
43+
};

lib/lando.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ module.exports = class Lando {
402402
caKey = this.config.caKey,
403403
domains = [],
404404
organization = 'Lando Alliance',
405-
validity = 365,
405+
validity = 3650,
406406
} = {}) {
407407
const read = require('../utils/read-file');
408408
const write = require('../utils/write-file');

0 commit comments

Comments
 (0)