Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use @zemn.me on mastodon. #7256

Open
wants to merge 1 commit into
base: pr7255
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions ts/pulumi/lib/website.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,30 @@ function relative(from: string, to: string): string {
return path.relative(f, t);
}

// had to copy since not exported 😠
export interface BucketWebsiteConfigurationV2RoutingRuleRedirect {
/**
* Host name to use in the redirect request.
*/
hostName?: pulumi.Input<string>;
/**
* HTTP redirect code to use on the response.
*/
httpRedirectCode?: pulumi.Input<string>;
/**
* Protocol to use when redirecting requests. The default is the protocol that is used in the original request. Valid values: `http`, `https`.
*/
protocol?: pulumi.Input<string>;
/**
* Object key prefix to use in the redirect request. For example, to redirect requests for all pages with prefix `docs/` (objects in the `docs/` folder) to `documents/`, you can set a `condition` block with `keyPrefixEquals` set to `docs/` and in the `redirect` set `replaceKeyPrefixWith` to `/documents`.
*/
replaceKeyPrefixWith?: pulumi.Input<string>;
/**
* Specific object key to use in the redirect request. For example, redirect request to `error.html`.
*/
replaceKeyWith?: pulumi.Input<string>;
}

export interface Args {
/**
* Zone to create any needed DNS records in.
Expand Down Expand Up @@ -82,6 +106,8 @@ export interface Args {
* Whether to set up email for this website.
*/
email: boolean

redirect?: pulumi.Input<Map<string, BucketWebsiteConfigurationV2RoutingRuleRedirect>>
}

/**
Expand Down Expand Up @@ -225,6 +251,15 @@ export class Website extends pulumi.ComponentResource {
const s3Site = new aws.s3.BucketWebsiteConfigurationV2(
`${name}_bucket_website`,
{
routingRules:
pulumi.output(args.redirect).apply(
m => m == undefined ? [] : [...m].map(([from, to]) => ({
condition: {
keyPrefixEquals: from
},
redirect: to
}))
),
bucket: bucket.bucket,
indexDocument: {
suffix: "index.html"
Expand Down
10 changes: 9 additions & 1 deletion ts/pulumi/zemn.me/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as Pulumi from '@pulumi/pulumi';
import { bskyDid } from '#root/project/zemn.me/bio/bio.js';
import { BlueskyDisplayNameClaim } from '#root/ts/pulumi/lib/bluesky_username_claim.js';
import { mergeTags, tagTrue } from '#root/ts/pulumi/lib/tags.js';
import Website from '#root/ts/pulumi/lib/website.js';
import Website, { BucketWebsiteConfigurationV2RoutingRuleRedirect } from '#root/ts/pulumi/lib/website.js';

export interface Args {
zoneId: Pulumi.Input<string>;
Expand Down Expand Up @@ -59,6 +59,14 @@ export class Component extends Pulumi.ComponentResource {
noIndex: true, // args.noIndex,
email: false,
tags,
redirect: new Map<string, BucketWebsiteConfigurationV2RoutingRuleRedirect>([
["/.well-known/host-meta", {
hostName: "fed.brid.gy",
}],
["/.well-known/webfinger", {
hostName: "fed.brid.gy",
}]
])
},
{ parent: this }
);
Expand Down
Loading