feat: able to use $$ in traefik config gen

fix: repman icon
This commit is contained in:
Andras Bacsai 2023-01-24 13:52:39 +01:00
parent 4c8babc96a
commit 655a8cd60d
6 changed files with 15 additions and 10 deletions

View File

@ -2,6 +2,7 @@ import { FastifyRequest } from 'fastify';
import { errorHandler, getDomain, isDev, prisma, executeCommand } from '../../../lib/common'; import { errorHandler, getDomain, isDev, prisma, executeCommand } from '../../../lib/common';
import { getTemplates } from '../../../lib/services'; import { getTemplates } from '../../../lib/services';
import { OnlyId } from '../../../types'; import { OnlyId } from '../../../types';
import { parseAndFindServiceTemplates } from '../../api/v1/services/handlers';
function generateServices(serviceId, containerId, port, isHttp2 = false, isHttps = false) { function generateServices(serviceId, containerId, port, isHttp2 = false, isHttps = false) {
if (isHttp2) { if (isHttp2) {
@ -534,11 +535,11 @@ export async function proxyConfiguration(request: FastifyRequest<OnlyId>, remote
if (!found) { if (!found) {
continue; continue;
} }
found = JSON.parse(JSON.stringify(found).replaceAll('$$id', id)); found = await parseAndFindServiceTemplates(service, null, true);
for (const oneService of Object.keys(found.services)) { for (const oneService of Object.keys(found.services)) {
const isDomainConfiguration = const isDomainAndProxyConfiguration =
found?.services[oneService]?.proxy?.filter((p) => p.domain) ?? []; found?.services[oneService]?.proxy?.filter((p) => p.domain && p.port) ?? [];
if (isDomainConfiguration.length > 0) { if (isDomainAndProxyConfiguration.length > 0) {
const { proxy } = found.services[oneService]; const { proxy } = found.services[oneService];
for (let configuration of proxy) { for (let configuration of proxy) {
if (configuration.domain) { if (configuration.domain) {

View File

@ -4,9 +4,11 @@ import { proxyConfiguration, otherProxyConfiguration } from './handlers';
import { OtherProxyConfiguration } from './types'; import { OtherProxyConfiguration } from './types';
const root: FastifyPluginAsync = async (fastify): Promise<void> => { const root: FastifyPluginAsync = async (fastify): Promise<void> => {
fastify.get<OnlyId>('/main.json', async (request, reply) => proxyConfiguration(request, false)); fastify.get<OnlyId>('/main.json', async (request, reply) => proxyConfiguration(request, false));
fastify.get<OnlyId>('/remote/:id', async (request) => proxyConfiguration(request, true)); fastify.get<OnlyId>('/remote/:id', async (request) => proxyConfiguration(request, true));
fastify.get<OtherProxyConfiguration>('/other.json', async (request, reply) => otherProxyConfiguration(request)); fastify.get<OtherProxyConfiguration>('/other.json', async (request, reply) =>
otherProxyConfiguration(request)
);
}; };
export default root; export default root;

View File

@ -6,7 +6,6 @@
let extension = 'png'; let extension = 'png';
let svgs = [ let svgs = [
'mattermost', 'mattermost',
'repman',
'directus', 'directus',
'pocketbase', 'pocketbase',
'gitea', 'gitea',

View File

@ -34,6 +34,7 @@
import { page } from '$app/stores'; import { page } from '$app/stores';
import { get, post } from '$lib/api'; import { get, post } from '$lib/api';
import { errorNotification } from '$lib/common'; import { errorNotification } from '$lib/common';
import Beta from '$lib/components/Beta.svelte';
import ServiceIcons from '$lib/components/svg/services/ServiceIcons.svelte'; import ServiceIcons from '$lib/components/svg/services/ServiceIcons.svelte';
import { onMount } from 'svelte'; import { onMount } from 'svelte';
@ -116,12 +117,15 @@
</div> </div>
<div class=" lg:pt-20 lg:p-0 px-8 pt-20"> <div class=" lg:pt-20 lg:p-0 px-8 pt-20">
<div class="grid grid-flow-rows grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-8"> <div class="grid grid-flow-rows grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-8">
{#each sortMe(filteredServices).filter(s=> !s.ignore) as service} {#each sortMe(filteredServices).filter((s) => !s.ignore) as service}
{#key service.name} {#key service.name}
<button <button
on:click={() => handleSubmit(service)} on:click={() => handleSubmit(service)}
class="box-selection relative text-xl font-bold hover:bg-primary" class="box-selection relative text-xl font-bold hover:bg-primary"
> >
{#if service.isBeta}
<div class="text-center"><Beta /></div>
{/if}
<div class="flex flex-col"> <div class="flex flex-col">
<div class="flex justify-center items-center gap-2 pb-4"> <div class="flex justify-center items-center gap-2 pb-4">
<ServiceIcons type={service.type} /> <ServiceIcons type={service.type} />

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="153" height="55" fill-rule="evenodd"><path fill="#000" d="M23.994 54.878L.322 41.253v-27.25L23.994.38l23.672 13.625v27.25z"/><g fill="#fff"><path d="M24.277 19.284V12.17l13.768 7.92v7.1zm13.768 15.852V28.02l-13.768 7.92v7.1l13.768-7.907z"/><path d="M24.28 28.025v7.115l13.768-7.92v-7.1L24.28 28.025zm-.615-8.74V12.17L9.898 20.1v7.1z"/><path d="M9.898 35.136V28.02l13.768 7.92v7.1L9.898 35.136zm13.77-7.108v7.117L9.9 27.22v-7.104z"/></g><path d="M60 34.64V19.403h3.778v1.827c.33-.516.676-.92 1.037-1.208a4.55 4.55 0 0 1 1.115-.666 4.27 4.27 0 0 1 1.161-.294c.392-.04.795-.062 1.208-.062h.526v4.12a6.77 6.77 0 0 0-1.115-.093c-2.457 0-3.685 1.228-3.685 3.685v7.928H60zm19.045-9.106c-.02-.557-.12-1.048-.294-1.47a3.07 3.07 0 0 0-.697-1.053c-.29-.28-.62-.485-1-.62a3.35 3.35 0 0 0-1.146-.201c-.805 0-1.502.294-2.1.883s-.924 1.4-1.006 2.462h6.225zm-6.348 2.54c.062 1.156.397 2.075 1.006 2.756s1.4 1.022 2.4 1.022c.66 0 1.244-.15 1.75-.45s.83-.717.976-1.254h4.15c-.475 1.57-1.3 2.777-2.477 3.623s-2.58 1.27-4.212 1.27c-5.08 0-7.618-2.766-7.618-8.3 0-1.177.165-2.24.495-3.2s.8-1.765 1.44-2.446a6.32 6.32 0 0 1 2.307-1.564c.907-.36 1.95-.53 3.126-.53 2.354 0 4.134.754 5.342 2.26s1.812 3.778 1.812 6.813H72.697zm19.076 3.53c2.312 0 3.468-1.57 3.468-4.707 0-1.363-.32-2.472-.96-3.33s-1.466-1.285-2.477-1.285c-.97 0-1.78.403-2.43 1.208s-.976 1.858-.976 3.16c0 3.303 1.125 4.955 3.376 4.955zm-7.185 10.25v-22.45h3.87l.03 1.858c.93-1.507 2.343-2.26 4.243-2.26a6.32 6.32 0 0 1 2.648.557c.816.37 1.512.908 2.1 1.6s1.032 1.56 1.363 2.57.495 2.157.495 3.437c0 1.156-.14 2.214-.418 3.174s-.686 1.8-1.223 2.493a5.52 5.52 0 0 1-1.966 1.626c-.774.382-1.657.573-2.648.573-1.88 0-3.386-.795-4.52-2.385v9.198H84.6zm34.065-7.214V25.4c0-.93-.217-1.683-.65-2.26a2.06 2.06 0 0 0-1.734-.867c-.743 0-1.357.3-1.843.93s-.728 1.394-.728 2.323v9.105h-4.026v-9.167c0-.62-.04-1.125-.124-1.517s-.222-.702-.418-.93a1.57 1.57 0 0 0-.76-.48c-.3-.093-.68-.14-1.115-.14-1.63 0-2.446 1-2.446 2.973v9.26h-4.026V19.403h3.778v2.23c.516-1.012 1.135-1.703 1.858-2.075s1.6-.557 2.6-.557c.516 0 .975.04 1.378.124a3.34 3.34 0 0 1 1.084.418c.32.196.624.45.914.76a8.57 8.57 0 0 1 .867 1.115c.413-.846.96-1.46 1.64-1.843s1.507-.573 2.477-.573a5.58 5.58 0 0 1 2.106.387c.64.258 1.187.62 1.64 1.084s.8 1.006 1.068 1.626.387 1.28.387 1.982v10.56h-3.933zm14.74-7.464c-.207.206-.506.372-.898.495s-.96.258-1.703.403c-1.157.227-1.95.516-2.385.867s-.65.857-.65 1.517c0 1.135.65 1.703 1.95 1.703a3.88 3.88 0 0 0 1.44-.263 3.59 3.59 0 0 0 1.146-.712 3.57 3.57 0 0 0 .774-1.053c.196-.403.294-.83.294-1.285l.03-1.672zm.28 7.463c-.124-.392-.207-.846-.248-1.363-.475.537-1.105.965-1.9 1.285s-1.693.48-2.725.48c-1.754 0-3.04-.387-3.855-1.16s-1.223-1.78-1.223-3.02c0-1.094.175-1.966.526-2.617a3.92 3.92 0 0 1 1.455-1.533c.62-.372 1.358-.645 2.214-.82l2.802-.48c1-.145 1.693-.335 2.044-.573s.526-.625.526-1.16c0-.495-.232-.883-.697-1.16s-1.1-.418-1.874-.418c-.93 0-1.595.206-1.998.62s-.655.96-.76 1.64h-3.747c.02-.784.15-1.507.387-2.168a4.15 4.15 0 0 1 1.146-1.703c.526-.475 1.213-.84 2.06-1.1s1.88-.387 3.097-.387c1.198 0 2.214.134 3.05.403s1.507.655 2.013 1.16.872 1.135 1.1 1.9.34 1.605.34 2.555v9.63h-3.747zm15.266.001V25.4c0-1.177-.196-1.972-.588-2.385s-1.063-.62-2.013-.62c-2.085 0-3.128 1.166-3.128 3.5v8.733h-4.025V19.403h3.84v2.23c.475-.867 1.104-1.523 1.9-1.966S146.7 19 147.95 19a6.05 6.05 0 0 1 2.013.325c.62.217 1.15.542 1.595.976s.795.965 1.053 1.595.387 1.357.387 2.183v10.56h-4.057z" fill="#000"/></svg>

Before

Width:  |  Height:  |  Size: 3.4 KiB