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

Using theme in docker #1787

Closed
siarhei-kurhuzenkau-idf opened this issue Nov 4, 2021 · 7 comments
Closed

Using theme in docker #1787

siarhei-kurhuzenkau-idf opened this issue Nov 4, 2021 · 7 comments

Comments

@siarhei-kurhuzenkau-idf
Copy link

siarhei-kurhuzenkau-idf commented Nov 4, 2021

Hello,

Following the requests
#570
and
#1438

I see that there is the theme description in https://redoc.ly/docs/api-reference-docs/configuration/theming/
but it is unclear how to correctly use those options in dockerfile

I tried
REDOC_OPTIONS="disable-search hide-download-button typography.fontsize:"10px" "
and
REDOC_OPTIONS="disable-search hide-download-button theme.typography.fontsize:"10px" "
and
REDOC_OPTIONS="disable-search hide-download-button "theme":{"typography":{"fontSize": "16px"}}"
and
REDOC_OPTIONS="disable-search hide-download-button {"theme":{"typography":{"fontSize": "16px"}}}"

disable-search - works
hide-download-button - works
addressing nested theme json properties does not

Any examples, documentation will be appreciated

@AlexVarchuk
Copy link
Collaborator

Hello, @siarhei-kurhuzenkau-idf .Thanks for the request.
Try to pass theme object like JSON file

REDOC_OPTIONS="disable-search hide-download-button theme='$(<./temp.json)'"

temp.json

{"typography":{"fontSize": "16px"}}

@AlexVarchuk
Copy link
Collaborator

@siarhei-kurhuzenkau-idf Hi! If you'll have some questions, please reopen this issue. Thanks.

@ernestomi
Copy link

ernestomi commented Dec 21, 2021

Hi @AlexVarchuk!

Is there no other way? Something like passing the location of the JSON file.

The problem when doing it via Dockerfile is that you cant set the ENV from the output of a command such as $(<./temp.json) or at least not that I know

I see #1047 addresses the JSON string, but not specifically through a JSON file

@TaTo30
Copy link

TaTo30 commented Jan 17, 2022

This works for me:

REDOC_OPTIONS=disable-search hide-download-button theme='{"typography":{"fontSize": "16px"}}'

@ernestomi
Copy link

But this is not setting it from an external file. The problem is reading the file into the variable.

Sorry if this wasn't clear

@Crateros
Copy link

Crateros commented Feb 2, 2023

Wondering about this also, I am running the redocly container via docker compose, trying to get some of the custom options to propagate through ENV variables defined in the docker-compose.yml file.

  redoc-ui:
    image: redocly/redoc
    ports:
      - 8000:80
    environment:
      SPEC_URL: 'http://localhost:8000/swagger/'
      PAGE_TITLE: 'Test API'
      PAGE_FAVICON: 'https://example.com/static/images/favicon.ico'
      REDOC_OPTIONS: 'disable-search hide-download-button theme={"typography":{"fontSize": "16px"}}'

disable-search and hide-download-button work, but I cannot get any of the theme properties to apply.

@jweaver85
Copy link

jweaver85 commented Feb 7, 2023

I could not get the $(<./temp.json) syntax to work and ended up just using jq to minify a human-readable json file. I set up a repo with working examples for docker compose, docker image extending redoc, and the "one-liner" docker command. I hope this helps someone if the other examples didn't work for you.

https://github.com/jweaver85/docker-redoc-theming

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

6 participants