-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
160 additions
and
179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# Context Management | ||
|
||
|
||
## Auto Configuration with boiler.yaml | ||
|
||
Provide authentication credentials to flask-boiler by moving the json certificate file | ||
to your project directory and specify the path in ```boiler.yaml``` | ||
in your current working directory. | ||
|
||
```yaml | ||
app_name: "<Your Firebase App Name>" | ||
debug: True | ||
testing: True | ||
certificate_filename: "<File Name of Certificate JSON>" | ||
``` | ||
|
||
In ```__init__``` of your project source root: | ||
```python | ||
from flask_boiler.context import Context as CTX | ||
|
||
CTX.load() | ||
``` | ||
|
||
## Manual Configuration | ||
In `__init__` of your project source root: | ||
```python | ||
import os | ||
|
||
from flask_boiler import context | ||
from flask_boiler import config | ||
|
||
Config = config.Config | ||
|
||
testing_config = Config(app_name="your_app_name", | ||
debug=True, | ||
testing=True, | ||
certificate_path=os.path.curdir + "/../your_project/config_jsons/your_certificate.json") | ||
|
||
CTX = context.Context | ||
CTX.read(testing_config) | ||
``` | ||
|
||
Note that initializing `Config` with `certificate_path` is unstable and | ||
may be changed later. | ||
|
||
In your project code, | ||
|
||
```python | ||
from flask_boiler import context | ||
|
||
CTX = context.Context | ||
|
||
# Retrieves firestore database instance | ||
CTX.db | ||
|
||
# Retrieves firebase app instance | ||
CTX.firebase_app | ||
|
||
``` | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1 @@ | ||
.. _context-management: | ||
|
||
Context Management | ||
================== | ||
|
||
In ```__init__``` of your project source root: | ||
|
||
.. code-block:: python | ||
import os | ||
from flask_boiler import context | ||
from flask_boiler import config | ||
Config = config.Config | ||
testing_config = Config(app_name="your_app_name", | ||
debug=True, | ||
testing=True, | ||
certificate_path=os.path.curdir + "/../your_project/config_jsons/your_certificate.json") | ||
CTX = context.Context | ||
CTX.read(testing_config) | ||
Note that initializing ```Config``` with ```certificate_path``` is unstable and | ||
may be changed later. | ||
|
||
In your project code, | ||
|
||
.. code-block:: python | ||
from flask_boiler import context | ||
CTX = context.Context | ||
# Retrieves firestore database instance | ||
CTX.db | ||
# Retrieves firebase app instance | ||
CTX.firebase_app | ||
.. mdinclude:: ../context_management.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.