# Configure additional Snowplow Micro settings
> Enable HTTPS with SSL/TLS certificates, add custom Iglu resolver configurations, and modify collector settings. Advanced configuration options for Snowplow Micro using bind mounts and environment variables.
> Source: https://docs.snowplow.io/docs/testing/snowplow-micro/local/advanced-usage/
> Documentation index: https://docs.snowplow.io/llms.txt

This page describes additional configuration options for Snowplow Micro.

## Enabling HTTPS

While in most cases HTTP is sufficient, you may want to enable HTTPS in Micro (for an example of when that’s useful, see [Locally resolving an existing domain name to Micro](/docs/testing/snowplow-micro/local/remote-usage/#locally-resolving-an-existing-domain-name-to-micro)).

You will need an SSL/TLS certificate in [PKCS 12](https://en.wikipedia.org/wiki/PKCS_12) format (`.p12`). Pass your certificate file and its password to the container (using a [bind mount](https://docs.docker.com/storage/bind-mounts/) and an [environment variable](https://docs.docker.com/compose/environment-variables/)). Don’t forget to expose the HTTPS port (by default, 9543):

```bash
docker run -p 9090:9090 -p 9543:9543 \
--mount type=bind,source=$(pwd)/my-certificate.p12,destination=/config/ssl-certificate.p12 \
-e MICRO_SSL_CERT_PASSWORD=... \
snowplow/snowplow-micro:4.7.0
```

> **Note:** For the certificate, the path inside the container must be exactly `/config/ssl-certificate.p12`.

You should see a message like this in the logs:

```text
[INFO] com.snowplowanalytics.snowplow.micro.Main$ - HTTPS REST interface bound to /0.0.0.0:9543
```

As usual, you can change the ports to your liking (see [Running Micro](/docs/testing/snowplow-micro/local/)).

## Adding custom Iglu resolver configuration

If you’d like to tweak the Iglu registries Micro uses, the priority between them, the cache sizes, etc, you can provide your own [Iglu resolver configuration](/docs/api-reference/iglu/iglu-resolver/) (`iglu.json`).

> **Tip:** If you are just looking to add custom schemas or connect to your private Iglu registry, check out [Adding custom schemas](/docs/testing/snowplow-micro/local/schemas/) for simpler ways to achieve that.

Pass your configuration file to the container (using a [bind mount](https://docs.docker.com/storage/bind-mounts/)) and instruct Micro to use it:

```bash
docker run -p 9090:9090 \
--mount type=bind,source=$(pwd)/iglu.json,destination=/config/iglu.json \
snowplow/snowplow-micro:4.7.0 \
--iglu /config/iglu.json
```

That’s it. You can use the [the API](/docs/api-reference/snowplow-micro/api/#microiglu) to check if Micro is able to reach your schemas (replace `com.example` and `my-schema` as appropriate).

```bash
curl localhost:9090/micro/iglu/com.example/my-schema/jsonschema/1-0-0
```

## Adding custom Collector and Enrich configuration

If you’d like to tweak the [Collector](/docs/api-reference/stream-collector/configure/) or [Enrich](/docs/api-reference/enrichment-components/configuration-reference/) configuration inside Micro, the simplest approach is to override individual settings. For example, to change the cookie name:

```bash
docker run -p 9090:9090 \
snowplow/snowplow-micro:4.7.0 \
-Dcollector.cookie.name=sp
```

For more extensive changes, you can also bring your own configuration file (`micro.conf`). Collector settings should be inside `collector { ... }`, and Enrich settings inside `enrich { ... }`. (Adding Enrich settings is only supported since version 4.1.0.)

**Example**

```hocon
loading...
```

[View on GitHub](<https://github.com/snowplow/snowplow-micro/blob/master/example/micro.conf&#xA;>)

Pass your configuration file to the container (using a [bind mount](https://docs.docker.com/storage/bind-mounts/)) and instruct Micro to use it:

```bash
docker run -p 9090:9090 \
--mount type=bind,source=$(pwd)/micro.conf,destination=/config/micro.conf \
snowplow/snowplow-micro:4.7.0 \
--config /config/micro.conf
```

## Persisting events across restarts

By default, Micro only stores events in memory. Since version 4.0.0, you can connect it to a PostgreSQL database to persist events across restarts.

To enable this, first create a storage configuration file:

```hocon
host: localhost
port: 5432
database: micro_test
user: test_user

# How long to keep the events for (minimum: 5m)
ttl: 7d

# How often to clean up expired events (minimum: 1m)
cleanupInterval: 1h
```

Next, place the database password into an [environment variable](https://en.wikipedia.org/wiki/Environment_variable) named `MICRO_POSTGRESQL_PASSWORD`.

Now you can run Micro and pass the configuration, as well as the password:

```bash
docker run -p 9090:9090 \
--mount type=bind,source=$(pwd)/storage.conf,destination=/config/storage.conf \
-e MICRO_POSTGRESQL_PASSWORD \
snowplow/snowplow-micro:4.7.0 \
--storage /config/storage.conf
```
