Skip to content

Commit

Permalink
Merge branch 'main' into type-args-first-run
Browse files Browse the repository at this point in the history
  • Loading branch information
eandre authored Dec 16, 2024
2 parents e853ba9 + 30bbfbc commit bf807c0
Show file tree
Hide file tree
Showing 142 changed files with 8,694 additions and 2,655 deletions.
41 changes: 26 additions & 15 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cli/cmd/encore/app/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func promptAccountCreation() {
if _, err := conf.CurrentUser(); errors.Is(err, fs.ErrNotExist) && createAppOnPlatform {
PromptLoop:
for {
_, _ = cyan.Fprint(os.Stderr, "Create a free Encore account to enable Cloud Deployments, Secrets Management, and more? (Y/n): ")
_, _ = cyan.Fprint(os.Stderr, "Log in / Sign up for a free Encore Cloud account to enable automated cloud deployments? (Y/n): ")
var input string
_, _ = fmt.Scanln(&input)
input = strings.TrimSpace(input)
Expand Down
11 changes: 10 additions & 1 deletion cli/daemon/run/runtime_config2.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ import (
"fmt"
"net"
"net/netip"
"os"
"slices"
"sort"
"strconv"
"strings"
"time"

Expand Down Expand Up @@ -122,10 +124,17 @@ func (g *RuntimeConfigGenerator) initialize() error {
})

if traceEndpoint, ok := g.TraceEndpoint.Get(); ok {
sampleRate := 1.0
if val, err := strconv.ParseFloat(os.Getenv("ENCORE_TRACE_SAMPLING_RATE"), 64); err == nil {
sampleRate = min(max(val, 0), 1)
}
g.conf.TracingProvider(&runtimev1.TracingProvider{
Rid: newRid(),
Provider: &runtimev1.TracingProvider_Encore{
Encore: &runtimev1.TracingProvider_EncoreTracingProvider{TraceEndpoint: traceEndpoint},
Encore: &runtimev1.TracingProvider_EncoreTracingProvider{
TraceEndpoint: traceEndpoint,
SamplingRate: &sampleRate,
},
},
})
}
Expand Down
25 changes: 25 additions & 0 deletions docs/go/primitives/object-storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,31 @@ if err != nil {
}
```

## Using Public Buckets

Encore supports creating public buckets where objects can be accessed directly via HTTP/HTTPS without authentication. This is useful for serving static assets like images, videos, or other public files.

To create a public bucket, set `Public: true` in the `BucketConfig`:

```go
var PublicAssets = objects.NewBucket("public-assets", objects.BucketConfig{
Public: true,
})
```

Once configured as public, you can get the public URL for any object using the `PublicURL` method:

```go
// Get the public URL for an object
url := PublicAssets.PublicURL("path/to/image.jpg")

// The URL can be used directly or shared publicly
fmt.Println(url) // e.g. https://assets.example.com/path/to/image.jpg
```
When self-hosting, see how to configure public buckets in the [infrastructure configuration docs](/docs/ts/self-host/configure-infra).

When deploying with Encore Cloud it will automatically configure the bucket to be publicly accessible and [configure CDN](/docs/platform/infrastructure/infra#production-infrastructure) for optimal content delivery.

### Using bucket references

Encore uses static analysis to determine which services are accessing each bucket,
Expand Down
Loading

0 comments on commit bf807c0

Please sign in to comment.