Compare commits

...

13 Commits

Author SHA1 Message Date
Andras Bacsai
23e8833208 Merge pull request #339 from coollabsio/v2.4.5
v2.4.5
2022-04-12 19:08:46 +02:00
Andras Bacsai
03962663c2 fix: Timeout values 2022-04-12 18:21:10 +02:00
Andras Bacsai
cc2ec55c4d chore: version++ 2022-04-12 16:50:13 +02:00
Andras Bacsai
ff2c38aa16 fix: Invitations 2022-04-12 16:49:59 +02:00
Andras Bacsai
b5a9a2cea8 fix: Types 2022-04-12 16:49:52 +02:00
Andras Bacsai
cd3f661f7e Merge pull request #336 from coollabsio/v2.4.4
v2.4.4
2022-04-12 11:02:35 +02:00
Andras Bacsai
41bf6b5b86 fixes 2022-04-12 10:47:53 +02:00
Andras Bacsai
a4e7c85184 Add only amd release 2022-04-12 10:14:18 +02:00
Andras Bacsai
19aca9ab35 chore: version++ 2022-04-12 10:13:19 +02:00
Andras Bacsai
08704c289a fix: Proxy 2022-04-12 10:12:46 +02:00
Andras Bacsai
2224c22c6e fix: haproxy build stuffs 2022-04-12 09:22:27 +02:00
Andras Bacsai
b281889acd Merge branch 'main' of github.com:coollabsio/coolify into main 2022-04-12 09:20:12 +02:00
Andras Bacsai
cfc50a27b0 Package.json update 2022-04-12 09:19:48 +02:00
14 changed files with 140 additions and 79 deletions

View File

@@ -1,6 +1,6 @@
FROM haproxytech/haproxy-alpine:2.5 FROM haproxytech/haproxy-alpine:2.5
RUN mkdir -p /usr/local/etc/haproxy/ssl /usr/local/etc/haproxy/maps /usr/local/etc/haproxy/spoe RUN mkdir -p /usr/local/etc/haproxy/ssl /usr/local/etc/haproxy/maps /usr/local/etc/haproxy/spoe
COPY haproxy/haproxy.cfg-http.template /usr/local/etc/haproxy/haproxy.cfg COPY data/haproxy/haproxy.cfg-http.template /usr/local/etc/haproxy/haproxy.cfg
COPY haproxy/dataplaneapi.hcl /usr/local/etc/haproxy/dataplaneapi.hcl COPY data/haproxy/dataplaneapi.hcl /usr/local/etc/haproxy/dataplaneapi.hcl
COPY haproxy/ssl/default.pem /usr/local/etc/haproxy/ssl/default.pem COPY data/haproxy/ssl/default.pem /usr/local/etc/haproxy/ssl/default.pem

View File

@@ -1,6 +1,6 @@
FROM haproxytech/haproxy-alpine:2.5 FROM haproxytech/haproxy-alpine:2.5
RUN mkdir -p /usr/local/etc/haproxy/ssl /usr/local/etc/haproxy/maps /usr/local/etc/haproxy/spoe RUN mkdir -p /usr/local/etc/haproxy/ssl /usr/local/etc/haproxy/maps /usr/local/etc/haproxy/spoe
COPY haproxy/haproxy.cfg-tcp.template /usr/local/etc/haproxy/haproxy.cfg COPY data/haproxy/haproxy.cfg-tcp.template /usr/local/etc/haproxy/haproxy.cfg
COPY haproxy/dataplaneapi.hcl /usr/local/etc/haproxy/dataplaneapi.hcl COPY data/haproxy/dataplaneapi.hcl /usr/local/etc/haproxy/dataplaneapi.hcl
COPY haproxy/ssl/default.pem /usr/local/etc/haproxy/ssl/default.pem COPY data/haproxy/ssl/default.pem /usr/local/etc/haproxy/ssl/default.pem

View File

@@ -1,6 +1,6 @@
FROM haproxytech/haproxy-alpine:2.5 FROM haproxytech/haproxy-alpine:2.5
RUN mkdir -p /usr/local/etc/haproxy/ssl /usr/local/etc/haproxy/maps /usr/local/etc/haproxy/spoe RUN mkdir -p /usr/local/etc/haproxy/ssl /usr/local/etc/haproxy/maps /usr/local/etc/haproxy/spoe
COPY haproxy/haproxy.cfg.template /usr/local/etc/haproxy/haproxy.cfg COPY data/haproxy/haproxy.cfg.template /usr/local/etc/haproxy/haproxy.cfg
COPY haproxy/dataplaneapi.hcl /usr/local/etc/haproxy/dataplaneapi.hcl COPY data/haproxy/dataplaneapi.hcl /usr/local/etc/haproxy/dataplaneapi.hcl
COPY haproxy/ssl/default.pem /usr/local/etc/haproxy/ssl/default.pem COPY data/haproxy/ssl/default.pem /usr/local/etc/haproxy/ssl/default.pem

View File

@@ -1,7 +1,7 @@
{ {
"name": "coolify", "name": "coolify",
"description": "An open-source & self-hostable Heroku / Netlify alternative.", "description": "An open-source & self-hostable Heroku / Netlify alternative.",
"version": "2.4.3", "version": "2.4.5",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"scripts": { "scripts": {
"dev": "docker-compose -f docker-compose-dev.yaml up -d && cross-env NODE_ENV=development & svelte-kit dev", "dev": "docker-compose -f docker-compose-dev.yaml up -d && cross-env NODE_ENV=development & svelte-kit dev",
@@ -18,11 +18,12 @@
"db:seed": "prisma db seed", "db:seed": "prisma db seed",
"db:migrate": "COOLIFY_DATABASE_URL=file:../db/migration.db prisma migrate dev --skip-seed --name", "db:migrate": "COOLIFY_DATABASE_URL=file:../db/migration.db prisma migrate dev --skip-seed --name",
"release:production:all": "cross-var docker build --platform linux/amd64,linux/arm64 -t coollabsio/coolify:$npm_package_version -t coollabsio/coolify:latest --push .", "release:production:all": "cross-var docker build --platform linux/amd64,linux/arm64 -t coollabsio/coolify:$npm_package_version -t coollabsio/coolify:latest --push .",
"release:production:amd": "cross-var docker build --platform linux/amd64 -t coollabsio/coolify:$npm_package_version -t coollabsio/coolify:latest --push .",
"release:staging:all": "cross-var docker build --platform linux/amd64,linux/arm64 -t coollabsio/coolify:$npm_package_version --push .", "release:staging:all": "cross-var docker build --platform linux/amd64,linux/arm64 -t coollabsio/coolify:$npm_package_version --push .",
"release:staging:amd": "cross-var docker build --platform linux/amd64 -t coollabsio/coolify:$npm_package_version --push .", "release:staging:amd": "cross-var docker build --platform linux/amd64 -t coollabsio/coolify:$npm_package_version --push .",
"release:haproxy": "docker build --platform linux/amd64,linux/arm64 -t coollabsio/coolify-haproxy-alpine:latest -t coollabsio/coolify-haproxy-alpine:1.1.0 -f haproxy.Dockerfile --push .", "release:haproxy": "docker build --platform linux/amd64,linux/arm64 -t coollabsio/coolify-haproxy-alpine:latest -t coollabsio/coolify-haproxy-alpine:1.1.0 -f data/haproxy.Dockerfile --push .",
"release:haproxy:tcp": "docker build --platform linux/amd64,linux/arm64 -t coollabsio/coolify-haproxy-tcp-alpine:latest -t coollabsio/coolify-haproxy-tcp-alpine:1.1.0 -f haproxy-tcp.Dockerfile --push .", "release:haproxy:tcp": "docker build --platform linux/amd64,linux/arm64 -t coollabsio/coolify-haproxy-tcp-alpine:latest -t coollabsio/coolify-haproxy-tcp-alpine:1.1.0 -f data/haproxy-tcp.Dockerfile --push .",
"release:haproxy:http": "docker build --platform linux/amd64,linux/arm64 -t coollabsio/coolify-haproxy-http-alpine:latest -t coollabsio/coolify-haproxy-http-alpine:1.1.0 -f haproxy-http.Dockerfile --push .", "release:haproxy:http": "docker build --platform linux/amd64,linux/arm64 -t coollabsio/coolify-haproxy-http-alpine:latest -t coollabsio/coolify-haproxy-http-alpine:1.1.0 -f data/haproxy-http.Dockerfile --push .",
"prepare": "husky install" "prepare": "husky install"
}, },
"devDependencies": { "devDependencies": {
@@ -63,7 +64,7 @@
"@prisma/client": "3.11.1", "@prisma/client": "3.11.1",
"@sentry/node": "6.19.6", "@sentry/node": "6.19.6",
"bcryptjs": "^2.4.3", "bcryptjs": "^2.4.3",
"bullmq": "1.79.0", "bullmq": "1.80.0",
"compare-versions": "4.1.3", "compare-versions": "4.1.3",
"cookie": "0.4.2", "cookie": "0.4.2",
"cuid": "2.1.8", "cuid": "2.1.8",

16
pnpm-lock.yaml generated
View File

@@ -5,7 +5,7 @@ specifiers:
'@prisma/client': 3.11.1 '@prisma/client': 3.11.1
'@sentry/node': 6.19.6 '@sentry/node': 6.19.6
'@sveltejs/adapter-node': 1.0.0-next.73 '@sveltejs/adapter-node': 1.0.0-next.73
'@sveltejs/kit': 1.0.0-next.310 '@sveltejs/kit': 1.0.0-next.303
'@types/js-cookie': 3.0.1 '@types/js-cookie': 3.0.1
'@types/js-yaml': 4.0.5 '@types/js-yaml': 4.0.5
'@types/node': 17.0.23 '@types/node': 17.0.23
@@ -15,7 +15,7 @@ specifiers:
'@zerodevx/svelte-toast': 0.7.1 '@zerodevx/svelte-toast': 0.7.1
autoprefixer: 10.4.4 autoprefixer: 10.4.4
bcryptjs: ^2.4.3 bcryptjs: ^2.4.3
bullmq: 1.79.0 bullmq: 1.78.1
compare-versions: 4.1.3 compare-versions: 4.1.3
cookie: 0.4.2 cookie: 0.4.2
cross-env: 7.0.3 cross-env: 7.0.3
@@ -60,7 +60,7 @@ dependencies:
'@prisma/client': 3.11.1_prisma@3.11.1 '@prisma/client': 3.11.1_prisma@3.11.1
'@sentry/node': 6.19.6 '@sentry/node': 6.19.6
bcryptjs: 2.4.3 bcryptjs: 2.4.3
bullmq: 1.79.0 bullmq: 1.78.1
compare-versions: 4.1.3 compare-versions: 4.1.3
cookie: 0.4.2 cookie: 0.4.2
cuid: 2.1.8 cuid: 2.1.8
@@ -82,7 +82,7 @@ dependencies:
devDependencies: devDependencies:
'@sveltejs/adapter-node': 1.0.0-next.73 '@sveltejs/adapter-node': 1.0.0-next.73
'@sveltejs/kit': 1.0.0-next.310_svelte@3.47.0 '@sveltejs/kit': 1.0.0-next.303_svelte@3.47.0
'@types/js-cookie': 3.0.1 '@types/js-cookie': 3.0.1
'@types/js-yaml': 4.0.5 '@types/js-yaml': 4.0.5
'@types/node': 17.0.23 '@types/node': 17.0.23
@@ -374,10 +374,10 @@ packages:
tiny-glob: 0.2.9 tiny-glob: 0.2.9
dev: true dev: true
/@sveltejs/kit/1.0.0-next.310_svelte@3.47.0: /@sveltejs/kit/1.0.0-next.303_svelte@3.47.0:
resolution: resolution:
{ {
integrity: sha512-pTyMyaoyHS+V5cQZIQMfQXmLkhw1VaRwT9avOSgwDc0QBpnNw2LdzwoPYsUr96ca5B6cfT3SMUNolxErTNHmPQ== integrity: sha512-WdxDc8OiF1WEd/bEza7CBdzA+3qIcCi1GKBj/gieKX9I3N8iDJt/Cg2POrLo9wQoJ47nZcAd1eOhfr7XEX1aIQ==
} }
engines: { node: '>=14.13' } engines: { node: '>=14.13' }
hasBin: true hasBin: true
@@ -1669,10 +1669,10 @@ packages:
ieee754: 1.2.1 ieee754: 1.2.1
dev: false dev: false
/bullmq/1.79.0: /bullmq/1.78.1:
resolution: resolution:
{ {
integrity: sha512-rVtNCDpcWdc+U1MinRtvhJv+GBFNkz0Q3Unf20010qIC6Pj+O2kkIUeepBkCmMNz6G9abrhsee2PheGRJ32+sw== integrity: sha512-er45mM8nGhgA83EVCJ4PNxPyDSzakvoxeFGU4vdSgYeB+SbeFQAlJYmAC50Ms7YFPstm1LeinbVZ+oX/BmBzOg==
} }
dependencies: dependencies:
cron-parser: 4.2.1 cron-parser: 4.2.1

View File

@@ -1,11 +1,9 @@
// TODO: Make this functions generic
async function send({ async function send({
method, method,
path, path,
data = {}, data = {},
headers, headers,
timeout = 30000 timeout = 120000
}): Promise<Record<string, unknown>> { }): Promise<Record<string, unknown>> {
const controller = new AbortController(); const controller = new AbortController();
const id = setTimeout(() => controller.abort(), timeout); const id = setTimeout(() => controller.abort(), timeout);
@@ -53,7 +51,7 @@ async function send({
export function get( export function get(
path: string, path: string,
headers: Record<string, unknown> headers?: Record<string, unknown>
): Promise<Record<string, unknown>> { ): Promise<Record<string, unknown>> {
return send({ method: 'GET', path, headers }); return send({ method: 'GET', path, headers });
} }
@@ -61,7 +59,7 @@ export function get(
export function del( export function del(
path: string, path: string,
data: Record<string, unknown>, data: Record<string, unknown>,
headers: Record<string, unknown> headers?: Record<string, unknown>
): Promise<Record<string, unknown>> { ): Promise<Record<string, unknown>> {
return send({ method: 'DELETE', path, data, headers }); return send({ method: 'DELETE', path, data, headers });
} }
@@ -69,7 +67,7 @@ export function del(
export function post( export function post(
path: string, path: string,
data: Record<string, unknown>, data: Record<string, unknown>,
headers: Record<string, unknown> headers?: Record<string, unknown>
): Promise<Record<string, unknown>> { ): Promise<Record<string, unknown>> {
return send({ method: 'POST', path, data, headers }); return send({ method: 'POST', path, data, headers });
} }
@@ -77,7 +75,7 @@ export function post(
export function put( export function put(
path: string, path: string,
data: Record<string, unknown>, data: Record<string, unknown>,
headers: Record<string, unknown> headers?: Record<string, unknown>
): Promise<Record<string, unknown>> { ): Promise<Record<string, unknown>> {
return send({ method: 'PUT', path, data, headers }); return send({ method: 'PUT', path, data, headers });
} }

View File

@@ -18,18 +18,10 @@ export async function listSources(
export async function newSource({ export async function newSource({
name, name,
teamId, teamId
type,
htmlUrl,
apiUrl,
organization
}: { }: {
name: string; name: string;
teamId: string; teamId: string;
type: string;
htmlUrl: string;
apiUrl: string;
organization: string;
}): Promise<GitSource> { }): Promise<GitSource> {
return await prisma.gitSource.create({ return await prisma.gitSource.create({
data: { data: {
@@ -74,8 +66,11 @@ export async function getSource({
if (body?.gitlabApp?.appSecret) body.gitlabApp.appSecret = decrypt(body.gitlabApp.appSecret); if (body?.gitlabApp?.appSecret) body.gitlabApp.appSecret = decrypt(body.gitlabApp.appSecret);
return body; return body;
} }
export async function addGitHubSource({ id, teamId, type, name, htmlUrl, apiUrl }) { export async function addGitHubSource({ id, teamId, type, name, htmlUrl, apiUrl, organization }) {
await prisma.gitSource.update({ where: { id }, data: { type, name, htmlUrl, apiUrl } }); await prisma.gitSource.update({
where: { id },
data: { type, name, htmlUrl, apiUrl, organization }
});
return await prisma.githubApp.create({ return await prisma.githubApp.create({
data: { data: {
teams: { connect: { id: teamId } }, teams: { connect: { id: teamId } },
@@ -123,10 +118,14 @@ export async function configureGitsource({
} }
export async function updateGitsource({ export async function updateGitsource({
id, id,
name name,
htmlUrl,
apiUrl
}: { }: {
id: string; id: string;
name: string; name: string;
htmlUrl: string;
apiUrl: string;
}): Promise<GitSource> { }): Promise<GitSource> {
return await prisma.gitSource.update({ return await prisma.gitSource.update({
where: { id }, where: { id },

View File

@@ -1,6 +1,8 @@
import { dev } from '$app/env'; import { dev } from '$app/env';
import got, { type Got } from 'got'; import got, { type Got } from 'got';
import * as db from '$lib/database'; import * as db from '$lib/database';
import mustache from 'mustache';
import crypto from 'crypto';
import { checkContainer, checkHAProxy } from '.'; import { checkContainer, checkHAProxy } from '.';
import { asyncExecShell, getDomain, getEngine } from '$lib/common'; import { asyncExecShell, getDomain, getEngine } from '$lib/common';
import { supportedServiceTypesAndVersions } from '$lib/components/common'; import { supportedServiceTypesAndVersions } from '$lib/components/common';
@@ -18,10 +20,10 @@ global
defaults defaults
mode http mode http
log global log global
timeout http-request 60s timeout http-request 120s
timeout connect 10s timeout connect 10s
timeout client 60s timeout client 120s
timeout server 60s timeout server 120s
userlist haproxy-dataplaneapi userlist haproxy-dataplaneapi
user admin insecure-password "\${HAPROXY_PASSWORD}" user admin insecure-password "\${HAPROXY_PASSWORD}"
@@ -262,36 +264,20 @@ export async function configureHAProxy(): Promise<void> {
redirectValue, redirectValue,
redirectTo: isWWW ? domain.replace('www.', '') : 'www.' + domain redirectTo: isWWW ? domain.replace('www.', '') : 'www.' + domain
}); });
for (const service of services) { }
const { fqdn, id, type, destinationDocker, destinationDockerId, updatedAt } = service; const output = mustache.render(template, data);
if (destinationDockerId) { const newHash = crypto.createHash('md5').update(output).digest('hex');
const { engine } = destinationDocker; const { proxyHash, id } = await db.listSettings();
const found = supportedServiceTypesAndVersions.find((a) => a.name === type); if (proxyHash !== newHash) {
if (found) { await db.prisma.setting.update({ where: { id }, data: { proxyHash: newHash } });
const port = found.ports.main; await haproxy.post(`v2/services/haproxy/configuration/raw`, {
const publicPort = service[type]?.publicPort; searchParams: {
const isRunning = await checkContainer(engine, id); skip_version: true
if (fqdn) { },
const domain = getDomain(fqdn); body: output,
const isHttps = fqdn.startsWith('https://'); headers: {
const isWWW = fqdn.includes('www.'); 'Content-Type': 'text/plain'
const redirectValue = `${isHttps ? 'https://' : 'http://'}${domain}%[capture.req.uri]`;
if (isRunning) {
data.services.push({
id,
port,
publicPort,
domain,
isRunning,
isHttps,
redirectValue,
redirectTo: isWWW ? domain.replace('www.', '') : 'www.' + domain,
updatedAt: updatedAt.getTime()
});
}
}
}
} }
} });
} }
} }

View File

@@ -2,7 +2,9 @@ import * as Bullmq from 'bullmq';
import { default as ProdBullmq, QueueScheduler } from 'bullmq'; import { default as ProdBullmq, QueueScheduler } from 'bullmq';
import { dev } from '$app/env'; import { dev } from '$app/env';
import { prisma } from '$lib/database'; import { prisma } from '$lib/database';
import builder from './builder'; import builder from './builder';
import logger from './logger';
import cleanup from './cleanup'; import cleanup from './cleanup';
import proxy from './proxy'; import proxy from './proxy';
import ssl from './ssl'; import ssl from './ssl';
@@ -142,5 +144,9 @@ buildWorker.on('failed', async (job: Bullmq.Job, failedReason) => {
const buildLogQueueName = 'log_queue'; const buildLogQueueName = 'log_queue';
const buildLogQueue = new Queue(buildLogQueueName, connectionOptions); const buildLogQueue = new Queue(buildLogQueueName, connectionOptions);
const buildLogWorker = new Worker(buildLogQueueName, async (job) => await logger(job), {
concurrency: 1,
...connectionOptions
});
export { buildQueue, buildLogQueue }; export { buildQueue, buildLogQueue };

View File

@@ -8,7 +8,6 @@ import type { RequestHandler } from '@sveltejs/kit';
export const get: RequestHandler = async (event) => { export const get: RequestHandler = async (event) => {
const { teamId, status, body } = await getUserDetails(event); const { teamId, status, body } = await getUserDetails(event);
if (status === 401) return { status, body }; if (status === 401) return { status, body };
console.log(teamId);
const { id } = event.params; const { id } = event.params;
try { try {
const destination = await db.getDestination({ id, teamId }); const destination = await db.getDestination({ id, teamId });

View File

@@ -32,6 +32,7 @@
export let account; export let account;
export let accounts; export let accounts;
export let invitations;
if (accounts.length === 0) { if (accounts.length === 0) {
accounts.push(account); accounts.push(account);
} }
@@ -74,12 +75,51 @@
return errorNotification(error); return errorNotification(error);
} }
} }
async function acceptInvitation(id, teamId) {
try {
await post(`/iam/team/${teamId}/invitation/accept.json`, { id });
return window.location.reload();
} catch ({ error }) {
return errorNotification(error);
}
}
async function revokeInvitation(id, teamId) {
try {
await post(`/iam/team/${teamId}/invitation/revoke.json`, { id });
return window.location.reload();
} catch ({ error }) {
return errorNotification(error);
}
}
</script> </script>
<div class="flex space-x-1 p-6 font-bold"> <div class="flex space-x-1 p-6 font-bold">
<div class="mr-4 text-2xl tracking-tight">Identity and Access Management</div> <div class="mr-4 text-2xl tracking-tight">Identity and Access Management</div>
</div> </div>
{#if invitations.length > 0}
<div class="mx-auto max-w-4xl px-6 py-4">
<div class="title font-bold">Pending invitations</div>
<div class="pt-10 text-center">
{#each invitations as invitation}
<div class="flex justify-center space-x-2">
<div>
Invited to <span class="font-bold text-pink-600">{invitation.teamName}</span> with
<span class="font-bold text-rose-600">{invitation.permission}</span> permission.
</div>
<button
class="hover:bg-green-500"
on:click={() => acceptInvitation(invitation.id, invitation.teamId)}>Accept</button
>
<button
class="hover:bg-red-600"
on:click={() => revokeInvitation(invitation.id, invitation.teamId)}>Delete</button
>
</div>
{/each}
</div>
</div>
{/if}
<div class="mx-auto max-w-4xl px-6 py-4"> <div class="mx-auto max-w-4xl px-6 py-4">
{#if $session.teamId === '0' && accounts.length > 0} {#if $session.teamId === '0' && accounts.length > 0}
<div class="title font-bold">Accounts</div> <div class="title font-bold">Accounts</div>

View File

@@ -2,6 +2,7 @@
export let source; export let source;
import { page, session } from '$app/stores'; import { page, session } from '$app/stores';
import { post } from '$lib/api'; import { post } from '$lib/api';
import Explainer from '$lib/components/Explainer.svelte';
import { errorNotification } from '$lib/form'; import { errorNotification } from '$lib/form';
import { toast } from '@zerodevx/svelte-toast'; import { toast } from '@zerodevx/svelte-toast';
const { id } = $page.params; const { id } = $page.params;
@@ -51,7 +52,8 @@
type: 'github', type: 'github',
name: source.name, name: source.name,
htmlUrl: source.htmlUrl.replace(/\/$/, ''), htmlUrl: source.htmlUrl.replace(/\/$/, ''),
apiUrl: source.apiUrl.replace(/\/$/, '') apiUrl: source.apiUrl.replace(/\/$/, ''),
organization: source.organization
}); });
} catch ({ error }) { } catch ({ error }) {
return errorNotification(error); return errorNotification(error);
@@ -97,6 +99,22 @@
<label for="apiUrl" class="text-base font-bold text-stone-100">API URL</label> <label for="apiUrl" class="text-base font-bold text-stone-100">API URL</label>
<input name="apiUrl" id="apiUrl" required bind:value={source.apiUrl} /> <input name="apiUrl" id="apiUrl" required bind:value={source.apiUrl} />
</div> </div>
<div class="grid grid-cols-2">
<div class="flex flex-col">
<label for="organization" class="pt-2 text-base font-bold text-stone-100"
>Organization</label
>
<Explainer
text="Fill it if you would like to use an organization's as your Git Source. Otherwise your user will be used."
/>
</div>
<input
name="organization"
id="organization"
placeholder="eg: coollabsio"
bind:value={source.organization}
/>
</div>
</div> </div>
{#if source.apiUrl && source.htmlUrl && source.name} {#if source.apiUrl && source.htmlUrl && source.name}
<div class="text-center"> <div class="text-center">
@@ -135,6 +153,21 @@
<label for="apiUrl" class="text-base font-bold text-stone-100">API URL</label> <label for="apiUrl" class="text-base font-bold text-stone-100">API URL</label>
<input name="apiUrl" id="apiUrl" required bind:value={source.apiUrl} /> <input name="apiUrl" id="apiUrl" required bind:value={source.apiUrl} />
</div> </div>
<div class="grid grid-cols-2">
<div class="flex flex-col">
<label for="organization" class="pt-2 text-base font-bold text-stone-100"
>Organization</label
>
</div>
<input
readonly
disabled
name="organization"
id="organization"
placeholder="eg: coollabsio"
bind:value={source.organization}
/>
</div>
</div> </div>
</form> </form>
{:else} {:else}

View File

@@ -9,8 +9,8 @@ export const post: RequestHandler = async (event) => {
const { id } = event.params; const { id } = event.params;
try { try {
let { type, name, htmlUrl, apiUrl } = await event.request.json(); let { type, name, htmlUrl, apiUrl, organization } = await event.request.json();
await db.addGitHubSource({ id, teamId, type, name, htmlUrl, apiUrl }); await db.addGitHubSource({ id, teamId, type, name, htmlUrl, apiUrl, organization });
return { status: 201 }; return { status: 201 };
} catch (error) { } catch (error) {
return ErrorHandler(error); return ErrorHandler(error);

View File

@@ -36,7 +36,6 @@
export let settings; export let settings;
onMount(() => { onMount(() => {
const { organization, id, htmlUrl } = source; const { organization, id, htmlUrl } = source;
console.log(source);
const { fqdn } = settings; const { fqdn } = settings;
const host = dev const host = dev
? 'http://localhost:3000' ? 'http://localhost:3000'