Skip to content

Commit 3fd1576

Browse files
committed
[19.0][ADD] fs_storage_environment: make server_environment an optional dependency
1 parent 0eb8c38 commit 3fd1576

11 files changed

Lines changed: 669 additions & 0 deletions

File tree

fs_storage_environment/README.rst

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
.. image:: https://odoo-community.org/readme-banner-image
2+
:target: https://odoo-community.org/get-involved?utm_source=readme
3+
:alt: Odoo Community Association
4+
5+
===============================================
6+
Filesystem Storage Backend - Server Environment
7+
===============================================
8+
9+
..
10+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
11+
!! This file is generated by oca-gen-addon-readme !!
12+
!! changes will be overwritten. !!
13+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
14+
!! source digest: sha256:156bf422ce912fb80137f8203230a58ff1f4159a2f6befa17aa9eec9fb6dbcd5
15+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
16+
17+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
18+
:target: https://odoo-community.org/page/development-status
19+
:alt: Beta
20+
.. |badge2| image:: https://img.shields.io/badge/license-LGPL--3-blue.png
21+
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
22+
:alt: License: LGPL-3
23+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstorage-lightgray.png?logo=github
24+
:target: https://github.com/OCA/storage/tree/19.0/fs_storage_environment
25+
:alt: OCA/storage
26+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
27+
:target: https://translation.odoo-community.org/projects/storage-19-0/storage-19-0-fs_storage_environment
28+
:alt: Translate me on Weblate
29+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
30+
:target: https://runboat.odoo-community.org/builds?repo=OCA/storage&target_branch=19.0
31+
:alt: Try me on Runboat
32+
33+
|badge1| |badge2| |badge3| |badge4| |badge5|
34+
35+
Glue module to make Server Environment features available for the
36+
Filesystem Storage Backend addon.
37+
38+
**Table of contents**
39+
40+
.. contents::
41+
:local:
42+
43+
Usage
44+
=====
45+
46+
Configuration
47+
-------------
48+
49+
When you create a new backend, you must specify the following:
50+
51+
- Resolve env vars. This options resolves the protocol options values
52+
starting with $ from environment variables
53+
54+
Server Environment
55+
------------------
56+
57+
To ease the management of the filesystem storages configuration accross
58+
the different environments, the configuration of the filesystem storages
59+
can be defined in environment files or directly in the main
60+
configuration file. For example, the configuration of a filesystem
61+
storage with the code fsprod can be provided in the main configuration
62+
file as follows:
63+
64+
.. code:: ini
65+
66+
[fs_storage.fsprod]
67+
protocol=s3
68+
options={"endpoint_url": "https://my_s3_server/", "key": "KEY", "secret": "SECRET"}
69+
directory_path=my_bucket
70+
71+
To work, a storage.backend record must exist with the code fsprod into
72+
the database. In your configuration section, you can specify the value
73+
for the following fields:
74+
75+
- protocol
76+
- options
77+
- directory_path
78+
79+
Bug Tracker
80+
===========
81+
82+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/storage/issues>`_.
83+
In case of trouble, please check there if your issue has already been reported.
84+
If you spotted it first, help us to smash it by providing a detailed and welcomed
85+
`feedback <https://github.com/OCA/storage/issues/new?body=module:%20fs_storage_environment%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
86+
87+
Do not contact contributors directly about support or help with technical issues.
88+
89+
Credits
90+
=======
91+
92+
Authors
93+
-------
94+
95+
* ACSONE SA/NV
96+
97+
Contributors
98+
------------
99+
100+
- Laurent Mignon <laurent.mignon@acsone.eu>
101+
- Sébastien BEAU <sebastien.beau@akretion.com>
102+
- Maksym Yankin <maksym.yankin@camptocamp.com>
103+
104+
Maintainers
105+
-----------
106+
107+
This module is maintained by the OCA.
108+
109+
.. image:: https://odoo-community.org/logo.png
110+
:alt: Odoo Community Association
111+
:target: https://odoo-community.org
112+
113+
OCA, or the Odoo Community Association, is a nonprofit organization whose
114+
mission is to support the collaborative development of Odoo features and
115+
promote its widespread use.
116+
117+
This module is part of the `OCA/storage <https://github.com/OCA/storage/tree/19.0/fs_storage_environment>`_ project on GitHub.
118+
119+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

fs_storage_environment/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import models
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright 2017 Akretion (http://www.akretion.com).
2+
# @author Sébastien BEAU <sebastien.beau@akretion.com>
3+
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
4+
5+
{
6+
"name": "Filesystem Storage Backend - Server Environment",
7+
"summary": "Use Server Environment feature to manage the concept of Storage",
8+
"version": "19.0.1.0.0",
9+
"category": "FS Storage",
10+
"website": "https://github.com/OCA/storage",
11+
"author": " ACSONE SA/NV, Odoo Community Association (OCA)",
12+
"license": "LGPL-3",
13+
"development_status": "Beta",
14+
"installable": True,
15+
"depends": ["fs_storage", "server_environment"],
16+
"auto_install": True,
17+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import fs_storage
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Copyright 2023 ACSONE SA/NV (https://www.acsone.eu).
2+
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
3+
import logging
4+
5+
from odoo import models
6+
7+
_logger = logging.getLogger(__name__)
8+
9+
10+
class FSStorage(models.Model):
11+
_name = "fs.storage"
12+
_inherit = ["fs.storage", "server.env.mixin"]
13+
_server_env_section_name_field = "code"
14+
15+
@property
16+
def _server_env_fields(self):
17+
return {
18+
"protocol": {},
19+
"options": {},
20+
"directory_path": {},
21+
"eval_options_from_env": {},
22+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["whool"]
3+
build-backend = "whool.buildapi"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
- Laurent Mignon \<laurent.mignon@acsone.eu\>
2+
- Sébastien BEAU \<sebastien.beau@akretion.com\>
3+
- Maksym Yankin \<maksym.yankin@camptocamp.com\>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Glue module to make Server Environment features available for the
2+
Filesystem Storage Backend addon.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
## Configuration
2+
3+
When you create a new backend, you must specify the following:
4+
5+
- Resolve env vars. This options resolves the protocol options values
6+
starting with \$ from environment variables
7+
8+
## Server Environment
9+
10+
To ease the management of the filesystem storages configuration accross
11+
the different environments, the configuration of the filesystem storages
12+
can be defined in environment files or directly in the main
13+
configuration file. For example, the configuration of a filesystem
14+
storage with the code fsprod can be provided in the main configuration
15+
file as follows:
16+
17+
``` ini
18+
[fs_storage.fsprod]
19+
protocol=s3
20+
options={"endpoint_url": "https://my_s3_server/", "key": "KEY", "secret": "SECRET"}
21+
directory_path=my_bucket
22+
```
23+
24+
To work, a storage.backend record must exist with the code fsprod into
25+
the database. In your configuration section, you can specify the value
26+
for the following fields:
27+
28+
- protocol
29+
- options
30+
- directory_path
9.23 KB
Loading

0 commit comments

Comments
 (0)