r-scheele / rego_builder

Write your rego authorization rules from the frontend - Open policy agent
1 stars 1 forks source link

Restructure Application #4

Closed Youngestdev closed 2 years ago

Youngestdev commented 2 years ago

Major change

Application folders have been restructured as well as files properly named to suit their usage.

Improvements

  1. The initialize_repo function starts by creating the base folder where repositories containing the policy files will be stored. It then proceeds to check if a local repo path is present:

    • If this folder is present, the next set of operations are ignored to prevent overwriting the current files and folder.
    • If the folder isn't present, the GitHub repo supplied to the function is cloned to the assigned path /tmp/fastgeoapi.
  2. The git_push function has been updated to take two arguments: the repository path as well as the path to the .git folder to reduce the inline manipulation of file path in the function body.


To use this API, these are the steps you should follow:

  1. Create a .env file containing the following parameters:
GITHUB_ACCESS_TOKEN = 
GITHUB_USERNAME =
GITHUB_URL = 

The GITHUB_URL is the repo containing ( or will contain ) the policy files.

At the moment, the auth.rego file which is created is stored in the base folder of the repository. Once the API is working properly and the persistence issue has been solved by @r-scheele, I will make provisions to store the policy files in a policy directory.

  1. Run the application from the entrypoint:
$ python main.py

The interactive documentation page located at http://localhost:8000/docs can be used to play with requests and verify the GitHub automation implemented.

Breaking Changes

None.

Comments

If you encounter any issue using this API or have a suggestion, please file an issue and it will be attended to.