Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create and use a configuration file #20

Open
IanTaylorFB opened this issue Sep 20, 2018 · 0 comments
Open

Create and use a configuration file #20

IanTaylorFB opened this issue Sep 20, 2018 · 0 comments
Assignees

Comments

@IanTaylorFB
Copy link
Collaborator

We have a number of parameters that are pretty static at a room / day / conference level, that are better placed in a configuration file rather than command line parameters that may be forgotten.

Suggest we create
/var/www/data/config/pycon_video_manager_config.yml as a YAML configuration file, with the following content:

Use YAML because:

  • It’s more easily human-readable and human-writable than JSON
  • Especially, it allows comments

Here’s an example, based on the currently-required parameters.

---

# PyCon Video Manager configuration

# Variables generally do not need to be quoted.
# Indentation is meaningful, like Python!
# Comments (like this) are allowed.

# Conference level parameters
conference:
    # This additional tag is added to uploaded videos, along with a standard set of tags.
    year_tag: pyconuk2018
    # URL to fetch the schedule metadata. We may need another URL for POST updates.
    schedule_url: https://2018.hq.pyconuk.org/schedule/json/

# Room or computer deployment parameters
computer:
    # The project data root can also be specified on the command line.
    project_data_root: /var/www/data
    # Video file extension to upload.
    video_file_extension: mp4
    # Default YouTube category 
    # See https://developers.google.com/youtube/v3/docs/videoCategories/list
    default_category: 22
    # Default YouTube privacy (choose from unlisted, private, public)
    default_privacy: private

...

Suggest we use this program logic:

find the current script location (should be /var/www/html/<script>
search for the 'html' part
get the stem before that (yields /var/www)
append 'data' and 'config' (yields /var/www/data/config)
look for the pycon_video_manager_config.yml
if we don't find it, create the directory, and
copy the example from the project repository, and
tell the user
if we find it, use it

alternately, if we are given a --root parameter
look for the configuration file in <root>/config
@IanTaylorFB IanTaylorFB self-assigned this Sep 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant