<commit_before># Envy

Configuration switcher by an environment variable inspired by Perl's [Config::ENV](http://search.cpan.org/~satoh/Config-ENV/lib/Config/ENV.pm).

## Usage

```common-lisp
(defpackage :myapp.config
  (:use :cl
        :envy))
(in-package :myapp.config)

(setf (config-env-var) "APP_ENV")

(defconfig :common
  `(:application-root ,(asdf:component-pathname (asdf:find-system :myapp))))

(defconfig |development|
  '(:debug T
    :database-type :sqlite3
    :database-connection-spec (:database-name "sqlite3.db")))

(defconfig |production|
  '(:database-type :mysql
    :database-connection-spec (:database-name "test"
                               :usename "whoami"
                               :password "<PASSWORD>")))

(defconfig |staging|
  `(:debug T
    ,@|production|))
```

```common-lisp
(defpackage :myapp
  (:use :cl)
  (:import-from :envy
                :config)
(in-package :myapp)

(getf (config :myapp.config) :database-type)
```

## Description

Envy is a configuration manager for various applications.

Envy uses an environment variable to determine a configuration to use. I'm not sure this is ideal even for Common Lisp applications, but this can separate configuration system from an implementation.

## Configurations

### Normal configurations

`ENVY:DEFCONFIG` is a macro for defining a named configuration.<commit_msg>Calling APP_ENV from the command line<commit_after># Envy

Configuration switcher by an environment variable inspired by Perl's [Config::ENV](http://search.cpan.org/~satoh/Config-ENV/lib/Config/ENV.pm).

## Usage

```common-lisp
(defpackage :myapp.config
  (:use :cl
        :envy))
(in-package :myapp.config)

(setf (config-env-var) "APP_ENV")

(defconfig :common
  `(:application-root ,(asdf:component-pathname (asdf:find-system :myapp))))

(defconfig |development|
  '(:debug T
    :database-type :sqlite3
    :database-connection-spec (:database-name "sqlite3.db")))

(defconfig |production|
  '(:database-type :mysql
    :database-connection-spec (:database-name "test"
                               :usename "whoami"
                               :password "<PASSWORD>")))

(defconfig |staging|
  `(:debug T
    ,@|production|))
```

```common-lisp
(defpackage :myapp
  (:use :cl)
  (:import-from :envy
                :config)
(in-package :myapp)

(getf (config :myapp.config) :database-type)
```

###  Calling APP_ENV from the command line

For example, `APP_ENV=development sbcl`  runs a REPL process that uses development config values.

## Description

Envy is a configuration manager for various applications.

Envy uses an environment variable to determine a configuration to use. I'm not sure this is ideal even for Common Lisp applications, but this can separate configuration system from an implementation.

## Configurations

### Normal configurations

`ENVY:DEFCONFIG` is a macro for defining a named configuration.
{'fraction_non_alphanumeric': 0.12745435756114365, 'fraction_numerical': 0.0013778849466069584, 'mean_word_length': 3.6464, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2796237', 'n_tokens_mistral': 914, 'n_tokens_neox': 877, 'n_words': 265}