or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

cli.mdcore-configuration.mderror-handling.mdframework-integration.mdindex.mdutilities.mdvalidation.md

cli.mddocs/

0

# Command Line Interface

1

2

Comprehensive CLI for project initialization, configuration management, validation, and debugging with support for multiple file formats and environments. The dynaconf CLI provides a powerful set of tools for managing configuration throughout the development lifecycle.

3

4

## Capabilities

5

6

### Project Initialization

7

8

Initialize new dynaconf projects with configuration templates and boilerplate.

9

10

```python { .api }

11

# dynaconf init [OPTIONS]

12

#

13

# Options:

14

# --format TEXT Configuration file format (toml, yaml, json, ini, py)

15

# --path TEXT Path to create the files (default: current directory)

16

# --vars TEXT Name for the main settings file (default: settings)

17

# --secrets TEXT Name for the secrets file (default: .secrets)

18

# --wg / --no-wg Generate .gitignore entries (default: --wg)

19

# -y, --yes Skip confirmation prompts

20

# --django Create Django-specific configuration

21

```

22

23

Usage examples:

24

25

```bash

26

# Initialize with TOML format (default)

27

dynaconf init

28

29

# Initialize with YAML format in specific directory

30

dynaconf init --format yaml --path ./config

31

32

# Initialize for Django project

33

dynaconf init --django --format yaml

34

35

# Initialize with custom file names

36

dynaconf init --vars config --secrets local_secrets

37

```

38

39

### Value Retrieval

40

41

Get specific configuration values with formatting and type casting options.

42

43

```python { .api }

44

# dynaconf get <key> [OPTIONS]

45

#

46

# Arguments:

47

# key Configuration key to retrieve

48

#

49

# Options:

50

# --default TEXT Default value if key doesn't exist

51

# --env TEXT Environment to read from

52

# --unparse Show raw value without parsing

53

```

54

55

Usage examples:

56

57

```bash

58

# Get a simple value

59

dynaconf get DATABASE_URL

60

61

# Get with default value

62

dynaconf get PORT --default 8000

63

64

# Get from specific environment

65

dynaconf get DEBUG --env production

66

67

# Get raw unparsed value

68

dynaconf get TEMPLATE_STRING --unparse

69

```

70

71

### Settings Inspection

72

73

List and inspect all configuration settings with detailed information.

74

75

```python { .api }

76

# dynaconf list [OPTIONS]

77

#

78

# Options:

79

# --env TEXT Environment to list (default: current)

80

# --key TEXT Filter by specific key pattern

81

# --more Show more detailed information

82

# --loader TEXT Filter by loader source

83

# --all Show settings from all environments

84

# --output TEXT Output format (table, yaml, json)

85

# --output-flat Show flattened output

86

# --json Output as JSON

87

```

88

89

Usage examples:

90

91

```bash

92

# List all settings

93

dynaconf list

94

95

# List settings from specific environment

96

dynaconf list --env production

97

98

# List with detailed information

99

dynaconf list --more

100

101

# List specific key pattern

102

dynaconf list --key "DATABASE*"

103

104

# Export as JSON

105

dynaconf list --json

106

107

# Show all environments

108

dynaconf list --all

109

```

110

111

### Configuration Export

112

113

Export settings to files or external services like Redis and Vault.

114

115

```python { .api }

116

# dynaconf write <to> [OPTIONS]

117

#

118

# Arguments:

119

# to Target (file path, redis://, vault://)

120

#

121

# Options:

122

# --vars TEXT Variable names to export (comma-separated)

123

# --secrets TEXT Export secrets separately

124

# --path TEXT Source path for settings

125

# --env TEXT Environment to export

126

# -y, --yes Skip confirmation prompts

127

```

128

129

Usage examples:

130

131

```bash

132

# Export to TOML file

133

dynaconf write settings_backup.toml

134

135

# Export to YAML with specific variables

136

dynaconf write config.yaml --vars "DATABASE_URL,API_KEY"

137

138

# Export to Redis

139

dynaconf write redis://localhost:6379/0

140

141

# Export to HashiCorp Vault

142

dynaconf write vault://localhost:8200/secret/myapp

143

144

# Export specific environment

145

dynaconf write prod_config.json --env production

146

```

147

148

### Validation Runner

149

150

Run validation rules against configuration settings.

151

152

```python { .api }

153

# dynaconf validate [OPTIONS]

154

#

155

# Options:

156

# --path TEXT Path to settings files

157

```

158

159

Usage examples:

160

161

```bash

162

# Run validation with default settings

163

dynaconf validate

164

165

# Run validation with custom settings path

166

dynaconf validate --path ./config/

167

```

168

169

### Configuration Inspection

170

171

Inspect configuration loading history and debug settings resolution.

172

173

```python { .api }

174

# dynaconf inspect [OPTIONS]

175

#

176

# Options:

177

# --key TEXT Inspect specific key

178

# --env TEXT Environment to inspect

179

# --format TEXT Output format (yaml, json, table)

180

# --old-first Show oldest entries first

181

# --limit INTEGER Limit number of entries

182

# --all Include internal settings

183

# --report-mode Show detailed report

184

# --verbose Verbose output

185

```

186

187

Usage examples:

188

189

```bash

190

# Inspect all settings loading

191

dynaconf inspect

192

193

# Inspect specific key

194

dynaconf inspect --key DATABASE_URL

195

196

# Inspect with verbose output

197

dynaconf inspect --verbose

198

199

# Generate detailed report

200

dynaconf inspect --report-mode

201

202

# Inspect specific environment

203

dynaconf inspect --env production

204

```

205

206

### Global Options

207

208

Options available for all dynaconf commands.

209

210

```python { .api }

211

# Global Options:

212

# --instance/-i TEXT Custom settings instance path

213

# --version Show version information

214

# --docs Open documentation in browser

215

# --banner Show dynaconf banner

216

```

217

218

Usage examples:

219

220

```bash

221

# Use custom settings instance

222

dynaconf --instance myapp.config.settings list

223

224

# Show version

225

dynaconf --version

226

227

# Open documentation

228

dynaconf --docs

229

230

# Show banner

231

dynaconf --banner

232

```

233

234

## Supported Formats

235

236

### Input Formats

237

- **toml** - TOML configuration files

238

- **yaml** - YAML configuration files

239

- **json** - JSON configuration files

240

- **ini** - INI configuration files

241

- **py** - Python configuration files

242

- **env** - Environment variable files (.env)

243

244

### Output Formats

245

- **toml** - Export to TOML files

246

- **yaml** - Export to YAML files

247

- **json** - Export to JSON files

248

- **ini** - Export to INI files

249

- **py** - Export to Python files

250

- **redis** - Export to Redis database

251

- **vault** - Export to HashiCorp Vault

252

- **env** - Export to environment files

253

254

## Integration Examples

255

256

### CI/CD Pipeline Usage

257

258

```bash

259

# Validate configuration in CI

260

dynaconf validate --path ./deploy/

261

262

# Export production config

263

dynaconf write vault://prod-vault:8200/secret/app --env production

264

265

# Inspect configuration for debugging

266

dynaconf inspect --env staging --verbose

267

```

268

269

### Development Workflow

270

271

```bash

272

# Initialize new project

273

dynaconf init --format yaml

274

275

# Check current settings during development

276

dynaconf list --env development --more

277

278

# Export settings for testing

279

dynaconf write test_config.json --env testing

280

281

# Validate before deployment

282

dynaconf validate

283

```