Skip to content

Commit 859b1de

Browse files
committed
chore: portal feature flag for webhook custom headers & destination filter (#599)
* feat: implement portal ui config * chore: setup eslint & prettier for portal * chore: gofmt * docs: generate config
1 parent ed4dc98 commit 859b1de

File tree

30 files changed

+1881
-399
lines changed

30 files changed

+1881
-399
lines changed

docs/pages/references/configuration.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ Global configurations are provided through env variables or a YAML file. ConfigM
8787
| `OTEL_SERVICE_NAME` | The service name reported to OpenTelemetry. If set, OpenTelemetry will be enabled. | `nil` | No |
8888
| `PORTAL_BRAND_COLOR` | Primary brand color (hex code) for theming the Outpost Portal (e.g., '#6122E7'). Also referred to as Accent Color in some contexts. | `nil` | No |
8989
| `PORTAL_DISABLE_OUTPOST_BRANDING` | If true, disables Outpost branding in the portal. | `false` | No |
90+
| `PORTAL_ENABLE_DESTINATION_FILTER` | If true, enables destination filter UI in the portal. | `false` | No |
91+
| `PORTAL_ENABLE_WEBHOOK_CUSTOM_HEADERS` | If true, enables custom headers UI for webhook destinations in the portal. | `false` | No |
9092
| `PORTAL_FAVICON_URL` | URL for the favicon to be used in the Outpost Portal. | `nil` | No |
9193
| `PORTAL_FORCE_THEME` | Force a specific theme for the Outpost Portal (e.g., 'light', 'dark'). | `nil` | No |
9294
| `PORTAL_LOGO` | URL for the light-mode logo to be displayed in the Outpost Portal. | `nil` | No |
@@ -434,6 +436,12 @@ portal:
434436
# If true, disables Outpost branding in the portal.
435437
disable_outpost_branding: false
436438

439+
# If true, enables destination filter UI in the portal.
440+
enable_destination_filter: false
441+
442+
# If true, enables custom headers UI for webhook destinations in the portal.
443+
enable_webhook_custom_headers: false
444+
437445
# URL for the favicon to be used in the Outpost Portal.
438446
favicon_url: ""
439447

internal/config/portal.go

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,33 +8,37 @@ import (
88
)
99

1010
type PortalConfig struct {
11-
ProxyURL string `yaml:"proxy_url" env:"PORTAL_PROXY_URL" desc:"URL to proxy the Outpost Portal through. If set, Outpost serves the portal assets, and this URL is used as the base. Must be a valid URL." required:"N"`
12-
RefererURL string `yaml:"referer_url" env:"PORTAL_REFERER_URL" desc:"The URL where the user is redirected when the JWT token is expired or when the user clicks 'back'. Required if the Outpost Portal is enabled/used." required:"C"`
13-
FaviconURL string `yaml:"favicon_url" env:"PORTAL_FAVICON_URL" desc:"URL for the favicon to be used in the Outpost Portal." required:"N"`
14-
BrandColor string `yaml:"brand_color" env:"PORTAL_BRAND_COLOR" desc:"Primary brand color (hex code) for theming the Outpost Portal (e.g., '#6122E7'). Also referred to as Accent Color in some contexts." required:"N"`
15-
Logo string `yaml:"logo" env:"PORTAL_LOGO" desc:"URL for the light-mode logo to be displayed in the Outpost Portal." required:"N"`
16-
LogoDark string `yaml:"logo_dark" env:"PORTAL_LOGO_DARK" desc:"URL for the dark-mode logo to be displayed in the Outpost Portal." required:"N"`
17-
OrgName string `yaml:"org_name" env:"PORTAL_ORGANIZATION_NAME" desc:"Organization name displayed in the Outpost Portal." required:"N"`
18-
ForceTheme string `yaml:"force_theme" env:"PORTAL_FORCE_THEME" desc:"Force a specific theme for the Outpost Portal (e.g., 'light', 'dark')." required:"N"`
19-
DisableOutpostBranding bool `yaml:"disable_outpost_branding" env:"PORTAL_DISABLE_OUTPOST_BRANDING" desc:"If true, disables Outpost branding in the portal." required:"N"`
11+
ProxyURL string `yaml:"proxy_url" env:"PORTAL_PROXY_URL" desc:"URL to proxy the Outpost Portal through. If set, Outpost serves the portal assets, and this URL is used as the base. Must be a valid URL." required:"N"`
12+
RefererURL string `yaml:"referer_url" env:"PORTAL_REFERER_URL" desc:"The URL where the user is redirected when the JWT token is expired or when the user clicks 'back'. Required if the Outpost Portal is enabled/used." required:"C"`
13+
FaviconURL string `yaml:"favicon_url" env:"PORTAL_FAVICON_URL" desc:"URL for the favicon to be used in the Outpost Portal." required:"N"`
14+
BrandColor string `yaml:"brand_color" env:"PORTAL_BRAND_COLOR" desc:"Primary brand color (hex code) for theming the Outpost Portal (e.g., '#6122E7'). Also referred to as Accent Color in some contexts." required:"N"`
15+
Logo string `yaml:"logo" env:"PORTAL_LOGO" desc:"URL for the light-mode logo to be displayed in the Outpost Portal." required:"N"`
16+
LogoDark string `yaml:"logo_dark" env:"PORTAL_LOGO_DARK" desc:"URL for the dark-mode logo to be displayed in the Outpost Portal." required:"N"`
17+
OrgName string `yaml:"org_name" env:"PORTAL_ORGANIZATION_NAME" desc:"Organization name displayed in the Outpost Portal." required:"N"`
18+
ForceTheme string `yaml:"force_theme" env:"PORTAL_FORCE_THEME" desc:"Force a specific theme for the Outpost Portal (e.g., 'light', 'dark')." required:"N"`
19+
DisableOutpostBranding bool `yaml:"disable_outpost_branding" env:"PORTAL_DISABLE_OUTPOST_BRANDING" desc:"If true, disables Outpost branding in the portal." required:"N"`
20+
EnableDestinationFilter bool `yaml:"enable_destination_filter" env:"PORTAL_ENABLE_DESTINATION_FILTER" desc:"If true, enables destination filter UI in the portal." required:"N" default:"false"`
21+
EnableWebhookCustomHeaders bool `yaml:"enable_webhook_custom_headers" env:"PORTAL_ENABLE_WEBHOOK_CUSTOM_HEADERS" desc:"If true, enables custom headers UI for webhook destinations in the portal." required:"N" default:"false"`
2022
}
2123

2224
// GetPortalConfig returns the portal configuration with all necessary fields
2325
func (c *Config) GetPortalConfig() portal.PortalConfig {
2426
return portal.PortalConfig{
2527
ProxyURL: c.Portal.ProxyURL,
2628
Configs: map[string]string{
27-
"PROXY_URL": c.Portal.ProxyURL,
28-
"REFERER_URL": c.Portal.RefererURL,
29-
"FAVICON_URL": c.Portal.FaviconURL,
30-
"BRAND_COLOR": c.Portal.BrandColor,
31-
"LOGO": c.Portal.Logo,
32-
"LOGO_DARK": c.Portal.LogoDark,
33-
"ORGANIZATION_NAME": c.Portal.OrgName,
34-
"FORCE_THEME": c.Portal.ForceTheme,
35-
"TOPICS": strings.Join(c.Topics, ","),
36-
"DISABLE_OUTPOST_BRANDING": strconv.FormatBool(c.Portal.DisableOutpostBranding),
37-
"DISABLE_TELEMETRY": strconv.FormatBool(c.DisableTelemetry),
29+
"PROXY_URL": c.Portal.ProxyURL,
30+
"REFERER_URL": c.Portal.RefererURL,
31+
"FAVICON_URL": c.Portal.FaviconURL,
32+
"BRAND_COLOR": c.Portal.BrandColor,
33+
"LOGO": c.Portal.Logo,
34+
"LOGO_DARK": c.Portal.LogoDark,
35+
"ORGANIZATION_NAME": c.Portal.OrgName,
36+
"FORCE_THEME": c.Portal.ForceTheme,
37+
"TOPICS": strings.Join(c.Topics, ","),
38+
"DISABLE_OUTPOST_BRANDING": strconv.FormatBool(c.Portal.DisableOutpostBranding),
39+
"DISABLE_TELEMETRY": strconv.FormatBool(c.DisableTelemetry),
40+
"ENABLE_DESTINATION_FILTER": strconv.FormatBool(c.Portal.EnableDestinationFilter),
41+
"ENABLE_WEBHOOK_CUSTOM_HEADERS": strconv.FormatBool(c.Portal.EnableWebhookCustomHeaders),
3842
},
3943
}
4044
}

internal/portal/.prettierrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

internal/portal/eslint.config.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import js from "@eslint/js";
2+
import tseslint from "typescript-eslint";
3+
import reactHooks from "eslint-plugin-react-hooks";
4+
import eslintConfigPrettier from "eslint-config-prettier";
5+
6+
export default tseslint.config(
7+
{ ignores: ["dist", "node_modules"] },
8+
{
9+
files: ["**/*.{ts,tsx}"],
10+
extends: [js.configs.recommended, ...tseslint.configs.recommended],
11+
plugins: {
12+
"react-hooks": reactHooks,
13+
},
14+
rules: {
15+
// Disable most rules - minimal config for formatting only
16+
"@typescript-eslint/no-explicit-any": "off",
17+
"@typescript-eslint/no-unused-vars": "off",
18+
"@typescript-eslint/ban-ts-comment": "off",
19+
"@typescript-eslint/no-empty-object-type": "off",
20+
// Only keep basic react-hooks rule, disable strict ones
21+
"react-hooks/rules-of-hooks": "error",
22+
"react-hooks/exhaustive-deps": "off",
23+
},
24+
},
25+
eslintConfigPrettier,
26+
);

0 commit comments

Comments
 (0)