fix(strcuture): refactor responsibilities

This commit is contained in:
2025-05-19 17:28:05 +00:00
parent 8fb67922a5
commit 465148d553
62 changed files with 1414 additions and 2066 deletions

View File

@ -14,7 +14,7 @@ tap.test('should create ACME challenge route', async (tools) => {
{
name: 'secure-route',
match: {
ports: [443],
ports: [8443],
domains: 'test.example.com'
},
action: {
@ -22,14 +22,20 @@ tap.test('should create ACME challenge route', async (tools) => {
target: { host: 'localhost', port: 8080 },
tls: {
mode: 'terminate' as const,
certificate: 'auto',
certificate: 'auto' as const,
acme: {
email: 'test@test.local' // Use non-example.com domain
email: 'ssl@bleu.de',
challengePort: 8080 // Use non-privileged port for challenges
}
}
}
}
]
],
acme: {
email: 'ssl@bleu.de',
port: 8080, // Use non-privileged port globally
useProduction: false
}
};
const proxy = new SmartProxy(settings);
@ -42,7 +48,7 @@ tap.test('should create ACME challenge route', async (tools) => {
setUpdateRoutesCallback: function(callback: any) {
updateRoutesCallback = callback;
},
setNetworkProxy: function() {},
setHttpProxy: function() {},
setGlobalAcmeDefaults: function() {},
setAcmeStateManager: function() {},
initialize: async function() {
@ -52,7 +58,7 @@ tap.test('should create ACME challenge route', async (tools) => {
name: 'acme-challenge',
priority: 1000,
match: {
ports: 80,
ports: 8080,
path: '/.well-known/acme-challenge/*'
},
action: {
@ -96,7 +102,7 @@ tap.test('should create ACME challenge route', async (tools) => {
expect(challengeRoute).toBeDefined();
expect(challengeRoute.match.path).toEqual('/.well-known/acme-challenge/*');
expect(challengeRoute.match.ports).toEqual(80);
expect(challengeRoute.match.ports).toEqual(8080);
await proxy.stop();
});