Metadata-Version: 2.1
Name: roco
Version: 0.1.0
Summary: Runtime Config Generator
Author: Eugen Ciur
Author-email: eugen@papermerge.com
Requires-Python: >=3.10,<4.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Dist: click (>=8.1.3,<9.0.0)
Requires-Dist: jinja2 (>=3.1.2,<4.0.0)
Requires-Dist: pydantic (>=1.10.8,<2.0.0)
Description-Content-Type: text/markdown

# Roco - Runtime config generator

Command line utility tool which prints to the standard output javascript valid 
text generated from environment variables.

For example, given following environment variables:

    PAPERMERGE__AUTH__REDIRECT_URI=http://localhost:9000/callback
    PAPERMERGE__AUTH__INTERNAL_TOKEN_URL=http://localhost:9000/api/token
    PAPERMERGE__AUTH__GOOGLE_CLIENT_ID=some-id.apps.googleusercontent.com
    PAPERMERGE__AUTH__GOOGLE_AUTHORIZE_URL=https://accounts.google.com/o/oauth2/auth

will result in the following text (valid javascript) as output:

    window.__PAPERMERGE_RUNTIME_CONFIG__ = {
      oauth2: {
        internal_token_url: 'http://localhost:9000/api/token',
        redirect_uri: 'http://localhost:9000/callback',
        google: {
          client_id: 'some-id.apps.googleusercontent.com',
          authorize_url: 'https://accounts.google.com/o/oauth2/auth',
          scope: 'openid email',
        },
      }
    };


## Install

    pip install roco

## Usage

If no relevant environment variables were defined just running:

    roco

Will result in following output:

    window.__PAPERMERGE_RUNTIME_CONFIG__ = {
    };

i.e. valid, but empty, javascript object.
In order to see current roco's pydantic settings (read from env vars)
run:
    
    roco -s

The above command will also show the env var prefix i.e. `PAPERMERGE__AUTH__`.

Roco reads from following environment variables:

* `PAPERMERGE__AUTH__REDIRECT_URI`
* `PAPERMERGE__AUTH__INTERNAL_TOKEN_URL`
* `PAPERMERGE__AUTH__GOOGLE_AUTHORIZE_URL`
* `PAPERMERGE__AUTH__GOOGLE_CLIENT_ID`
* `PAPERMERGE__AUTH__GITHUB_AUTHORIZE_URL`
* `PAPERMERGE__AUTH__GITHUB_CLIENT_ID`


