# Ephemeral Mode
`ctrld` can operate in ephemeral mode which won't attempt to read or write any config file to disk. All necessary information is provided via command line flags.

## Launch arguments
```shell
$ ctrld run --help
Run the DNS proxy server

Usage:
  ctrld run [flags]

Flags:
      --base64_config string        base64 encoded config
      --cache_size int              Enable cache defined amount of slots
      --cd string                   Control D resolver uid
  -c, --config string               Path to config file
  -d, --daemon                      Run as daemon
      --domains strings             list of domain to apply in a split DNS policy
  -h, --help                        help for run
      --listen string               listener address and port, in format: address:port
      --log string                  path to log file
      --primary_upstream string     primary upstream endpoint
      --secondary_upstream string   secondary upstream endpoint

Global Flags:
  -v, --verbose count   verbose log output, "-v" means query logging enabled, "-vv" means debug level logging enabled
```

For example:

```shell
ctrld run --listen=127.0.0.1:53 --primary_upstream=https://freedns.controld.com/p2 --secondary_upstream=8.8.8.8:53 --domains=*.company.int,*.net --log /path/to/log.log
```

Above command will be translated roughly to this config:

```toml
[service]
    log_level = "debug"
    log_path = "/path/to/log.log"

[network.0]
    name = "Network 0"
    cidrs = ["0.0.0.0/0"]

[upstream.0]
    name = "https://freedns.controld.com/p2"
    endpoint = "https://freedns.controld.com/p2"
    type = "doh"

[upstream.1]
    name = "8.8.8.8:53"
    endpoint = "8.8.8.8:53"
    type = "legacy"
	
[listener.0]
    ip = "127.0.0.1"
    port = 53

    [listener.0.policy]
        rules = [
            {"*.company.int" = ["upstream.1"]},
            {"*.net" = ["upstream.1"]},
        ]
```

Only `listen` and `primary_upstream` flags are required. 

## Base64 encoded config
`ctrld` can read a complete base64 encoded config via command line flag. This allows you to supply complex configurations. 

```shell
ctrld run --base64_config=" "
```
