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

feat: add support for hetnzer cloud s3 storage #17

Merged
merged 1 commit into from
Oct 14, 2024
Merged
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
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ Currently the below providers are supported, but it could be used with other pro
- Cloudflare
- Vultr
- CleverCloud
- Hetzner Cloud

## Inputs

### `provider`

**Not Required** The s3 provider to use. Defaults to Linode. AWS, Linode, DigitalOcean, Scaleway, Cloudflare, Vultr, CleverCloud are supported.
**Not Required** The s3 provider to use. Defaults to Linode. AWS, Linode, DigitalOcean, Scaleway, Cloudflare, Vultr, CleverCloud, Hetzner Cloud are supported.

### `secret_key`

Expand Down
16 changes: 12 additions & 4 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24922,15 +24922,15 @@ exports["default"] = _default;
const defaults = __nccwpck_require__(724)

const providers = {
aws: ({ region = 'US', access_key = '', secret_key = ''}) => ({
aws: ({ region = 'US', access_key = '', secret_key = '' }) => ({
bucket_location: region,
host_base: 's3.amazonaws.com',
host_bucket: '%(bucket)s.s3.amazonaws.com',
website_endpoint: 'http://%(bucket)s.s3-website-%(location)s.amazonaws.com/',
access_key,
secret_key,
}),
digitalocean: ({ region = 'nyc3', access_key = '', secret_key = ''}) => ({
digitalocean: ({ region = 'nyc3', access_key = '', secret_key = '' }) => ({
bucket_location: region,
host_base: `${region}.digitaloceanspaces.com`,
host_bucket: `%(bucket)s.${region}.digitaloceanspaces.com`,
Expand All @@ -24954,15 +24954,15 @@ const providers = {
access_key,
secret_key,
}),
cloudflare: ({ account_id = '', region='auto', access_key = '', secret_key = '' }) => ({
cloudflare: ({ account_id = '', region = 'auto', access_key = '', secret_key = '' }) => ({
bucket_location: region,
host_base: `${account_id}.r2.cloudflarestorage.com`,
host_bucket: '',
website_endpoint: '',
access_key,
secret_key,
}),
vultr: ({ region = 'ewr1', access_key = '', secret_key = ''}) => ({
vultr: ({ region = 'ewr1', access_key = '', secret_key = '' }) => ({
bucket_location: region,
host_base: `${region}.vultrobjects.com`,
host_bucket: `%(bucket)s.${region}.vultrobjects.com`,
Expand All @@ -24978,6 +24978,14 @@ const providers = {
access_key,
secret_key,
}),
hcloud: ({ region = 'fsn1', access_key = '', secret_key = '' }) => ({
bucket_location: region,
host_base: `fsn1.your-objectstorage.com`,
host_bucket: `%(bucket)s.fsn1.your-objectstorage.com`,
website_endpoint: '',
access_key,
secret_key,
})
}

const makeConf = (provider) => {
Expand Down
16 changes: 12 additions & 4 deletions src/providers.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
const defaults = require('./defaults.json')

const providers = {
aws: ({ region = 'US', access_key = '', secret_key = ''}) => ({
aws: ({ region = 'US', access_key = '', secret_key = '' }) => ({
bucket_location: region,
host_base: 's3.amazonaws.com',
host_bucket: '%(bucket)s.s3.amazonaws.com',
website_endpoint: 'http://%(bucket)s.s3-website-%(location)s.amazonaws.com/',
access_key,
secret_key,
}),
digitalocean: ({ region = 'nyc3', access_key = '', secret_key = ''}) => ({
digitalocean: ({ region = 'nyc3', access_key = '', secret_key = '' }) => ({
bucket_location: region,
host_base: `${region}.digitaloceanspaces.com`,
host_bucket: `%(bucket)s.${region}.digitaloceanspaces.com`,
Expand All @@ -33,15 +33,15 @@ const providers = {
access_key,
secret_key,
}),
cloudflare: ({ account_id = '', region='auto', access_key = '', secret_key = '' }) => ({
cloudflare: ({ account_id = '', region = 'auto', access_key = '', secret_key = '' }) => ({
bucket_location: region,
host_base: `${account_id}.r2.cloudflarestorage.com`,
host_bucket: '',
website_endpoint: '',
access_key,
secret_key,
}),
vultr: ({ region = 'ewr1', access_key = '', secret_key = ''}) => ({
vultr: ({ region = 'ewr1', access_key = '', secret_key = '' }) => ({
bucket_location: region,
host_base: `${region}.vultrobjects.com`,
host_bucket: `%(bucket)s.${region}.vultrobjects.com`,
Expand All @@ -57,6 +57,14 @@ const providers = {
access_key,
secret_key,
}),
hcloud: ({ region = 'fsn1', access_key = '', secret_key = '' }) => ({
bucket_location: region,
host_base: `fsn1.your-objectstorage.com`,
host_bucket: `%(bucket)s.fsn1.your-objectstorage.com`,
website_endpoint: '',
access_key,
secret_key,
})
}

const makeConf = (provider) => {
Expand Down
10 changes: 10 additions & 0 deletions src/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,13 @@ const clevercloudConf = makeConf(providers.clevercloud({
for (const line of clevercloudConf) {
clevercloudWriter.write(line + '\r\n')
}

const hcloudWriter = createWriteStream('assets/test-results/hcloud')
const hcloudConf = makeConf(providers.hcloud({
access_key: 'top-secret',
secret_key: 'more secret'
}))

for (const line of hcloudConf) {
hcloudWriter.write(line + '\r\n')
}
Loading